diff --git a/System/Entropy.hs b/System/Entropy.hs
--- a/System/Entropy.hs
+++ b/System/Entropy.hs
@@ -33,6 +33,7 @@
 #endif
 
 import qualified Data.ByteString as B
+import Control.Exception (bracket)
 
 -- |Get a specific number of bytes of cryptographically
 -- secure random data using the system-specific facilities.
@@ -41,8 +42,4 @@
 -- Windows.  In short, this entropy is considered cryptographically secure
 -- but not true entropy.
 getEntropy :: Int -> IO B.ByteString
-getEntropy n = do
-    h <- openHandle
-    e <- hGetEntropy h n
-    closeHandle h
-    return e
+getEntropy = bracket openHandle closeHandle . flip hGetEntropy
diff --git a/System/EntropyNix.hs b/System/EntropyNix.hs
--- a/System/EntropyNix.hs
+++ b/System/EntropyNix.hs
@@ -35,7 +35,7 @@
 source :: FilePath
 source = "/dev/urandom"
 
--- |Handle for manual resource mangement
+-- |Handle for manual resource management
 data CryptHandle
     = CH Fd
 #ifdef HAVE_RDRAND
diff --git a/entropy.cabal b/entropy.cabal
--- a/entropy.cabal
+++ b/entropy.cabal
@@ -1,5 +1,5 @@
 name:           entropy
-version:        0.3.7
+version:        0.3.8
 description:    A platform independent method to obtain cryptographically strong entropy
                 (RDRAND when available anywhere, urandom on nix, CryptAPI on Windows, patches welcome)
                 Users looking for cryptographically strong (number-theoretically
@@ -29,6 +29,14 @@
 flag halvm
     description:        Build for the HaLVM
     default:            False
+
+
+custom-setup
+  setup-depends: Cabal >= 1.10 && < 2.2
+               , base < 5
+               , filepath < 1.5
+               , directory < 1.4
+               , process < 1.7
 
 library
   ghc-options:  -O2
