diff --git a/Database/PostgreSQL/LibPQ.hsc b/Database/PostgreSQL/LibPQ.hsc
--- a/Database/PostgreSQL/LibPQ.hsc
+++ b/Database/PostgreSQL/LibPQ.hsc
@@ -585,8 +585,11 @@
 -- same across operations on the 'Connection'.
 errorMessage :: Connection
              -> IO (Maybe B.ByteString)
-errorMessage = flip maybeBsFromConn c_PQerrorMessage
-
+errorMessage conn = withConn conn $ \cptr -> do
+        strptr <- c_PQerrorMessage cptr
+        if strptr == nullPtr
+          then return Nothing
+          else Just `fmap` B.packCString strptr
 
 -- | Obtains the file descriptor number of the connection socket to
 -- the server. (This will not change during normal operation, but
@@ -1951,18 +1954,6 @@
                -> (Ptr PGresult -> IO a)
                -> IO b
 enumFromResult result f = fmap (toEnum . fromIntegral) $ withResult result f
-
-
--- | Returns a ByteString with a finalizer that touches the ForeignPtr
--- PGconn that \"owns\" the CString to keep it alive.
---
--- The CString must be a null terminated c string. nullPtrs are
--- treated as 'Nothing'.
-maybeBsFromConn :: Connection
-                -> (Ptr PGconn -> IO CString)
-                -> IO (Maybe B.ByteString)
-maybeBsFromConn connection f =
-    withConn' connection $ \fp -> maybeBsFromForeignPtr fp f
 
 
 -- | Returns a ByteString with a finalizer that touches the ForeignPtr
diff --git a/postgresql-libpq.cabal b/postgresql-libpq.cabal
--- a/postgresql-libpq.cabal
+++ b/postgresql-libpq.cabal
@@ -1,5 +1,5 @@
 Name:                postgresql-libpq
-Version:             0.7
+Version:             0.7.1
 Synopsis:            low-level binding to libpq
 
 Description:         This is a binding to libpq: the C application
@@ -38,4 +38,4 @@
 source-repository this
   type:     git
   location: http://github.com/lpsmith/postgresql-libpq
-  tag:      v0.7
+  tag:      v0.7.1
