diff --git a/haskell/src/Crypto/Secp256k1.hs b/haskell/src/Crypto/Secp256k1.hs
--- a/haskell/src/Crypto/Secp256k1.hs
+++ b/haskell/src/Crypto/Secp256k1.hs
@@ -81,7 +81,8 @@
         maybe pfail return $ importPubKey =<< decodeHex str
 
 instance IsString PubKey where
-    fromString = fromJust . (importPubKey <=< decodeHex)
+    fromString = fromMaybe e . (importPubKey <=< decodeHex) where
+        e = error "Could not decode public key from hex string"
 
 instance Show PubKey where
     showsPrec d k = showParen (d > 10) $
@@ -94,7 +95,8 @@
         maybe pfail return $ msg =<< decodeHex str
 
 instance IsString Msg where
-    fromString = fromJust . (msg <=< decodeHex) 
+    fromString = fromMaybe e . (msg <=< decodeHex)  where
+        e = error "Could not decode message from hex string"
 
 instance Show Msg where
     showsPrec d m = showParen (d > 10) $
@@ -107,7 +109,8 @@
         maybe pfail return $ importSig =<< decodeHex str
 
 instance IsString Sig where
-    fromString = fromJust . (importSig <=< decodeHex) 
+    fromString = fromMaybe e . (importSig <=< decodeHex) where
+        e = error "Could not decode signature from hex string"
 
 instance Show Sig where
     showsPrec d s = showParen (d > 10) $
@@ -120,7 +123,8 @@
         maybe pfail return $ secKey =<< decodeHex str
 
 instance IsString SecKey where
-    fromString = fromJust . (secKey <=< decodeHex)
+    fromString = fromMaybe e . (secKey <=< decodeHex) where
+        e = error "Colud not decode secret key from hex string"
 
 instance Show SecKey where
     showsPrec d k = showParen (d > 10) $
@@ -133,7 +137,8 @@
         maybe pfail return $ tweak =<< decodeHex str
 
 instance IsString Tweak where
-    fromString = fromJust . (tweak <=< decodeHex)
+    fromString = fromMaybe e . (tweak <=< decodeHex) where
+        e = error "Could not decode tweak from hex string"
 
 instance Show Tweak where
     showsPrec d k = showParen (d > 10) $
diff --git a/haskell/test/Crypto/Secp256k1/Tests.hs b/haskell/test/Crypto/Secp256k1/Tests.hs
--- a/haskell/test/Crypto/Secp256k1/Tests.hs
+++ b/haskell/test/Crypto/Secp256k1/Tests.hs
@@ -3,7 +3,7 @@
 import           Crypto.Secp256k1
 import qualified Data.ByteString.Base16               as B16
 import qualified Data.ByteString.Char8                as B8
-import           Data.Maybe                           (fromJust)
+import           Data.Maybe                           (fromMaybe)
 import           Data.String                          (fromString)
 import           Data.String.Conversions              (cs)
 import           Test.Framework                       (Test, testGroup)
@@ -63,8 +63,9 @@
 
 isStringTweak :: SecKey -> Bool
 isStringTweak k = t == fromString (cs hex) where
-    t = fromJust . tweak $ getSecKey k
+    t = fromMaybe e . tweak $ getSecKey k
     hex = B16.encode $ getTweak t
+    e = error "Could not extract tweak from secret key"
 
 showReadTweak :: SecKey -> Bool
 showReadTweak k = showRead t where
diff --git a/secp256k1.cabal b/secp256k1.cabal
--- a/secp256k1.cabal
+++ b/secp256k1.cabal
@@ -1,5 +1,5 @@
 name:                secp256k1
-version:             0.4.1
+version:             0.4.2
 synopsis:            secp256k1 bindings for Haskell
 description:         Please see README.md
 homepage:            http://github.com/haskoin/secp256k1#readme
