diff --git a/Crypto/Random/Entropy.hs b/Crypto/Random/Entropy.hs
--- a/Crypto/Random/Entropy.hs
+++ b/Crypto/Random/Entropy.hs
@@ -64,8 +64,8 @@
       where (B.PS fptr o len) = bs
             loop d s i
                 | i == 0    = return ()
-                | i <= len  = B.memcpy d s i
-                | otherwise = B.memcpy d s len >> loop (d `plusPtr` len) s (i-len)
+                | i <= len  = B.memcpy d s (fromIntegral i)
+                | otherwise = B.memcpy d s (fromIntegral len) >> loop (d `plusPtr` len) s (i-len)
     entropyClose _ = return ()
 
 openBackend :: EntropySource b => b -> IO (Maybe EntropyBackend)
diff --git a/crypto-random.cabal b/crypto-random.cabal
--- a/crypto-random.cabal
+++ b/crypto-random.cabal
@@ -1,5 +1,5 @@
 Name:                crypto-random
-Version:             0.0.3
+Version:             0.0.4
 Description:         Simple cryptographic random related types
 License:             BSD3
 License-file:        LICENSE
