diff --git a/samtools-iteratee.cabal b/samtools-iteratee.cabal
--- a/samtools-iteratee.cabal
+++ b/samtools-iteratee.cabal
@@ -1,5 +1,5 @@
 Name:                samtools-iteratee
-Version:             0.2.2
+Version:             0.2.2.1
 Synopsis:            Iteratee interface to SamTools library
 Description:         Iteratee interface to SamTools library
 License:             MIT
@@ -17,8 +17,8 @@
 
 Library
   Exposed-modules:     Bio.SamTools.Iteratee
-  Build-depends:       base >= 4.2 && < 5, bytestring >= 0.9 && < 0.10, samtools >= 0.1.1, 
-                       transformers, iteratee >= 0.8 && < 0.9
+  Build-depends:       base >= 4.2 && <5, bytestring >= 0.9, samtools >= 0.1.1, 
+                       transformers, iteratee >= 0.8
   Hs-Source-Dirs:      src
 
 Executable bam-filter
@@ -26,7 +26,7 @@
     Buildable: False
   Main-Is:             BamFilter.hs
   Other-Modules:       Bio.SamTools.Iteratee
-  Build-depends:       base >= 4.2 && < 5, bytestring >= 0.9 && < 0.10, samtools >= 0.1.1, 
-                       transformers, iteratee >= 0.8 && < 0.9, monads-tf
+  Build-depends:       base >= 4.2 && <5, bytestring >= 0.9, samtools >= 0.1.1, 
+                       transformers, iteratee >= 0.8, monads-tf
   Hs-Source-Dirs:      src
   Ghc-options:         -Wall
diff --git a/src/Bio/SamTools/Iteratee.hs b/src/Bio/SamTools/Iteratee.hs
--- a/src/Bio/SamTools/Iteratee.hs
+++ b/src/Bio/SamTools/Iteratee.hs
@@ -17,11 +17,12 @@
   
 enumInHandle :: Bam.InHandle -> Iter.Enumerator [Bam.Bam1] IO a
 enumInHandle inh i0 = step i0
-  where step iter = Bam.get1 inh >>= maybe eof next
-          where eof = return iter
-                next b = Iter.runIter iter Iter.idoneM onCont
-                  where onCont k Nothing = step . k $ Iter.Chunk [b]
-                        onCont k e = return $ Iter.icont k e
+  where step iter = do mbam <- Bam.get1 inh
+                       case mbam of
+                         Nothing -> return iter -- eof
+                         Just b -> Iter.runIter iter Iter.idoneM onCont -- next
+                           where onCont k Nothing = step . k $ Iter.Chunk [b]
+                                 onCont k e = return $ Iter.icont k e
                         
 enumTam :: FilePath -> Iter.Enumerator [Bam.Bam1] IO a
 enumTam inname i0 = bracket (Bam.openTamInFile inname) Bam.closeInHandle $ \h ->
@@ -38,11 +39,12 @@
   
 enumQuery :: BamIndex.Query -> Iter.Enumerator [Bam.Bam1] IO a
 enumQuery q i0 = step i0
-  where step iter = BamIndex.next q >>= maybe eof next
-          where eof = return iter
-                next b = Iter.runIter iter Iter.idoneM onCont
-                  where onCont k Nothing = step . k $ Iter.Chunk [b]
-                        onCont k e       = return $ Iter.icont k e
+  where step iter = do mbam <- BamIndex.next q
+                       case mbam of
+                         Nothing -> return iter -- eof
+                         Just b -> Iter.runIter iter Iter.idoneM onCont -- next
+                           where onCont k Nothing = step . k $ Iter.Chunk [b]
+                                 onCont k e       = return $ Iter.icont k e
 
 enumIndexRegion :: BamIndex.IdxHandle -> Int -> (Int64, Int64) -> Iter.Enumerator [Bam.Bam1] IO a
 enumIndexRegion h tid bnds i0 = do
