diff --git a/hoauth2.cabal b/hoauth2.cabal
--- a/hoauth2.cabal
+++ b/hoauth2.cabal
@@ -1,7 +1,7 @@
 Cabal-version: 2.4
 Name:                hoauth2
 -- http://wiki.haskell.org/Package_versioning_policy
-Version:             1.12.0
+Version:             1.13.0
 
 Synopsis:            Haskell OAuth2 authentication client
 
@@ -75,7 +75,7 @@
                    Network.OAuth.OAuth2.AuthorizationRequest
 
   Build-Depends: base                 >= 4     && < 5,
-                 binary               >= 0.8.3.0 && < 0.8.8,
+                 binary               >= 0.8.3.0 && < 0.8.9,
                  text                 >= 0.11  && < 1.3,
                  bytestring           >= 0.9   && < 0.11,
                  http-conduit         >= 2.1   && < 2.4,
@@ -134,8 +134,8 @@
                        wai-middleware-static >= 0.8.1 && < 0.8.4,
                        mustache >= 2.2.3 && < 2.4.0,
                        mtl >= 2.2.1 && < 2.3,
-                       scotty >= 0.10.0 && < 0.12,
-                       binary >= 0.8.3.0 && < 0.8.8,
+                       scotty >= 0.10.0 && < 0.13,
+                       binary >= 0.8.3.0 && < 0.8.9,
                        parsec >= 3.1.11 && < 3.2.0 ,
                        hashable >= 1.2.6 && < 1.4.0,
                        hoauth2
diff --git a/src/Network/OAuth/OAuth2/Internal.hs b/src/Network/OAuth/OAuth2/Internal.hs
--- a/src/Network/OAuth/OAuth2/Internal.hs
+++ b/src/Network/OAuth/OAuth2/Internal.hs
@@ -195,7 +195,7 @@
         path = view pathL uri
       }
     req2 = (over hostLens . maybe id const . preview hostL) uri req
-    req3 = (over portLens . maybe (const defaultPort) const . preview portL) uri req2
+    req3 = (over portLens . (const . fromMaybe defaultPort). preview portL) uri req2
   return req3
 
 requestToUri :: Request -> URI
