diff --git a/SSLWrap.hs b/SSLWrap.hs
--- a/SSLWrap.hs
+++ b/SSLWrap.hs
@@ -11,7 +11,7 @@
 import Network.BSD                      ( getHostByName, defaultProtocol, hostAddress )
 import qualified Data.ByteString as B   ( hGetSome, hPut, null )
 import Control.Exception                ( bracket, finally, bracketOnError )
-import Control.Concurrent               ( killThread, takeMVar, MVar, ThreadId, newEmptyMVar, forkIOUnmasked
+import Control.Concurrent               ( killThread, takeMVar, MVar, ThreadId, newEmptyMVar, forkIOWithUnmask
                                         , putMVar
                                         )
 import Control.Monad                    ( liftM2 )
@@ -66,7 +66,7 @@
 myForkIO :: IO () -> IO (MVar (),ThreadId)
 myForkIO io = do
      m <- newEmptyMVar
-     t <- forkIOUnmasked (io `finally` putMVar m ())
+     t <- forkIOWithUnmask$ \unmask -> unmask (io `finally` putMVar m ())
      return (m,t)
 
 
diff --git a/imapget.cabal b/imapget.cabal
--- a/imapget.cabal
+++ b/imapget.cabal
@@ -1,5 +1,5 @@
 Name:         imapget
-Version:      0.0.2
+Version:      0.0.3
 Synopsis:     Downloads email from imap SSL servers.
 Description:  This programs shows how to use HaskellNet to download email from imap SSL servers.
               The IMAP implementation is provided by HaskellNet, and the SSL implementation is
@@ -37,7 +37,7 @@
 source-repository this
     type:     darcs
     location: http://patch-tag.com/r/facundo/imapget
-    tag:      0.0.2
+    tag:      0.0.3
 
 
 Executable imapget
@@ -48,7 +48,7 @@
   build-depends:    base < 5
                   , bytestring
                   , directory
-                  , HaskellNet<0.4
+                  , HaskellNet >=0.3.1 && <0.4
                   , HsOpenSSL
                   , network
                   , text
diff --git a/imapget.hs b/imapget.hs
--- a/imapget.hs
+++ b/imapget.hs
@@ -1,19 +1,20 @@
 
 import Control.Arrow                   ( second )
 import Control.Concurrent              ( forkIO, threadDelay )
-import Control.Exception               ( mask_ )
+import Control.Exception               ( mask_, catch )
 import Control.Monad                   ( when )
-import qualified Data.ByteString as B  ( ByteString, putStrLn )
+import qualified Data.ByteString as B  ( ByteString )
+import qualified Data.ByteString.Char8 as B  ( putStrLn )
 import Data.Char                       ( isDigit )
 import Network.HaskellNet.IMAP.Connection as I  ( IMAPConnection )
 import Network.HaskellNet.IMAP   as I  ( list, select, search, SearchQuery(..), fetch
                                        , connectIMAPPort, login 
                                        )
 import Network.Socket            as S  ( HostName, PortNumber )
+import Prelude hiding                  (catch)
 import System.Directory                ( canonicalizePath )
 import System.Environment              ( getArgs )
 import System.Exit                     ( exitFailure )
-import System.IO                       ( Handle )
 import System.IO.Error                 ( isDoesNotExistError )
 
 import SSLWrap                         ( mapSSL )
@@ -109,7 +110,7 @@
        
 
 
-withIMAP :: IMAPConf -> (I.IMAPConnection Handle -> IO a) -> IO a
+withIMAP :: IMAPConf -> (I.IMAPConnection -> IO a) -> IO a
 withIMAP c action = do
   -- launch thread for wrapping tcp with SSL
   cafile <- canonicalizePath "cacert.pem"
