diff --git a/Network/FastCGI.hsc b/Network/FastCGI.hsc
--- a/Network/FastCGI.hsc
+++ b/Network/FastCGI.hsc
@@ -75,6 +75,9 @@
 foreign import ccall unsafe "fcgiapp.h FCGX_PutStr" fcgx_putStr
     :: CString -> CInt -> StreamPtr -> IO CInt
 
+foreign import ccall unsafe "fcgiapp.h FCGX_FFlush" fcgx_fflush
+    :: StreamPtr -> IO CInt
+
 foreign import ccall safe "fcgiapp.h FCGX_Accept" fcgx_accept
     :: Ptr StreamPtr -> Ptr StreamPtr -> Ptr StreamPtr -> Ptr Environ -> IO CInt
 foreign import ccall unsafe "fcgiapp.h FCGX_Finish" fcgx_finish
@@ -229,8 +232,9 @@
   `catch` \(_ :: IOException) -> return ()
 
 fcgxPutCStringLen :: StreamPtr -> CStringLen -> IO ()
-fcgxPutCStringLen h (cs,len) =
+fcgxPutCStringLen h (cs,len) = do
     testReturn "FCGX_PutStr" $ fcgx_putStr cs (fromIntegral len) h
+    testReturn "FCGX_FFlush" $ fcgx_fflush h
 
 sRead :: StreamPtr -> IO Lazy.ByteString
 sRead h = buildByteString (fcgxGetBuf h) 4096
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/Setup.lhs b/Setup.lhs
deleted file mode 100644
--- a/Setup.lhs
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env runghc
-
-> module Main where
-> import Distribution.Simple
-
-> main :: IO ()
-> main = defaultMain
diff --git a/configure b/configure
deleted file mode 100644
--- a/configure
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-
-# subst standard header path variables
-if test -n "$CPPFLAGS" ; then
-    echo "Found CPPFLAGS in environment: '$CPPFLAGS'"
-    sed 's,@CPPFLAGS@,'"$CPPFLAGS"',g;s,@LDFLAGS@,'"$LDFLAGS"',g'  \
-        < fastcgi.buildinfo.in > fastcgi.buildinfo
-fi
diff --git a/fastcgi.buildinfo.in b/fastcgi.buildinfo.in
deleted file mode 100644
--- a/fastcgi.buildinfo.in
+++ /dev/null
@@ -1,3 +0,0 @@
-ghc-options: -optc@CPPFLAGS@
-cc-options:  @CPPFLAGS@
-ld-options:  @LDFLAGS@
diff --git a/fastcgi.cabal b/fastcgi.cabal
--- a/fastcgi.cabal
+++ b/fastcgi.cabal
@@ -1,27 +1,27 @@
-Name:           fastcgi
-Version:        3001.0.2.4
-Copyright:      Bjorn Bringert, Lemmih
-Maintainer:     Chris Done <chrisdone@gmail.com>
-License:        BSD3
-license-file:   LICENSE
-Category:       Network
-Synopsis:       A Haskell library for writing FastCGI programs
-Description:
- This library lets you write FastCGI programs. This package reuses the
- cgi package API, making it very easy to port CGI programs to FastCGI.
- The FastCGI C development kit is required to build this library.
-Cabal-version: >= 1.2.0
-build-type:     Configure
-extra-source-files: configure fastcgi.buildinfo.in
-
-flag small_base
-  description: Choose the new smaller, split-up base package.
-
-library
-  build-depends: base >= 4 && < 5, cgi >= 3000.0.0, bytestring >= 0.9.1.5
-  Extensions: ForeignFunctionInterface, EmptyDataDecls, ScopedTypeVariables
-  Exposed-Modules:
-     Network.FastCGI
-  ghc-options: -O2 -Wall
-  includes: fcgiapp.h
-  extra-libraries: fcgi
+Name:           fastcgi
+Version:        3001.0.2.5
+Copyright:      Bjorn Bringert, Lemmih
+Maintainer:     Krasimir Angelov <kr.angelov@gmail.com>
+License:        BSD3
+license-file:   LICENSE
+Category:       Network
+Synopsis:       A Haskell library for writing FastCGI programs
+Description:
+ This library lets you write FastCGI programs. The package reuses the
+ cgi package API, making it very easy to port CGI programs to FastCGI.
+ The FastCGI C development kit is required to build this library.
+Cabal-version: >= 1.6
+build-type:     Simple
+
+source-repository head
+  type:     git
+  location: https://github.com/krangelov/fastcgi
+
+library
+  build-depends: base >= 4 && < 5, cgi >= 3000.0.0, bytestring >= 0.9.1.5
+  Extensions: ForeignFunctionInterface, EmptyDataDecls, ScopedTypeVariables
+  Exposed-Modules:
+     Network.FastCGI
+  ghc-options: -Wall
+  includes: fcgiapp.h
+  extra-libraries: fcgi
