diff --git a/lzma-enumerator.cabal b/lzma-enumerator.cabal
--- a/lzma-enumerator.cabal
+++ b/lzma-enumerator.cabal
@@ -1,5 +1,5 @@
 name:                lzma-enumerator
-version:             0.1.2
+version:             0.1.3
 synopsis:            Enumerator interface for lzma/xz compression.
 description:
   High level bindings to xz-utils.
diff --git a/src/Bindings/Lzma.hsc b/src/Bindings/Lzma.hsc
--- a/src/Bindings/Lzma.hsc
+++ b/src/Bindings/Lzma.hsc
@@ -4,6 +4,8 @@
 <http://www.csie.ntu.edu.tw/~cjlin/liblinear/>.
 -}
 
+#include <stdio.h>
+#include <string.h>
 #include <bindings.dsl.h>
 #include <lzma.h>
 
diff --git a/src/Codec/Compression/Lzma/Enumerator.hs b/src/Codec/Compression/Lzma/Enumerator.hs
--- a/src/Codec/Compression/Lzma/Enumerator.hs
+++ b/src/Codec/Compression/Lzma/Enumerator.hs
@@ -140,7 +140,7 @@
   -- the normal case, we have some results..
   | availOut < bufferSize = do
       x <- getChunk streamPtr availOut
-      if availIn == 0 -- no more input, stop processing
+      if availIn == 0 && action /= c'LZMA_FINISH -- no more input, stop processing
         then return $ E.Chunks [x]
         else do
           -- run lzma_code forward just far enough to read all the input buffer
