diff --git a/Database/Persist/MongoDB.hs b/Database/Persist/MongoDB.hs
--- a/Database/Persist/MongoDB.hs
+++ b/Database/Persist/MongoDB.hs
@@ -110,6 +110,7 @@
 import Data.Time.Calendar (Day(..))
 import Data.Attoparsec.Number
 import Data.Char (toUpper)
+import Data.Word (Word16)
 import Data.Monoid (mappend)
 import Data.Typeable
 
@@ -121,14 +122,30 @@
                                 deriving (Show, Eq, Num)
 
 instance FromJSON NoOrphanNominalDiffTime where
+#if MIN_VERSION_aeson(0, 7, 0)    
+    parseJSON (Number x) = (return . NoOrphanNominalDiffTime . fromRational . toRational) x
+
+
+#else 
     parseJSON (Number (I x)) = (return . NoOrphanNominalDiffTime . fromInteger) x
     parseJSON (Number (D x)) = (return . NoOrphanNominalDiffTime . fromRational . toRational) x
+
+#endif                           
     parseJSON _ = fail "couldn't parse diff time"
 
 newtype NoOrphanPortID = NoOrphanPortID PortID deriving (Show, Eq)
 
+
 instance FromJSON NoOrphanPortID where
+#if MIN_VERSION_aeson(0, 7, 0)  
+    parseJSON (Number  x) = (return . NoOrphanPortID . PortNumber . fromIntegral ) cnvX
+      where cnvX :: Word16
+            cnvX = round x 
+
+#else
     parseJSON (Number (I x)) = (return . NoOrphanPortID . PortNumber . fromInteger) x
+
+#endif
     parseJSON _ = fail "couldn't parse port number"
 
 
diff --git a/persistent-mongoDB.cabal b/persistent-mongoDB.cabal
--- a/persistent-mongoDB.cabal
+++ b/persistent-mongoDB.cabal
@@ -1,5 +1,5 @@
 name:            persistent-mongoDB
-version:         1.3.0.1
+version:         1.3.0.2
 license:         MIT
 license-file:    LICENSE
 author:          Greg Weber <greg@gregweber.info>
