diff --git a/IOSpec.cabal b/IOSpec.cabal
--- a/IOSpec.cabal
+++ b/IOSpec.cabal
@@ -1,63 +1,55 @@
-Name:		        IOSpec
-Version:        	0.3
-License:        	BSD3
-License-file:		LICENSE
-Author:			Wouter Swierstra, Yusaku Hashimoto, Nikolay Amiantov
-Maintainer:     	Wouter Swierstra <wouter.swierstra@gmail.com>
-Synopsis:       	A pure specification of the IO monad.
-Description:		This package consists of several modules, that give a
-			pure specification of functions in the IO monad:
-			.
-                           * "Test.IOSpec.Fork": a pure specification of
-			      'forkIO'.
-			.
-			   * "Test.IOSpec.IORef": a pure specification of most
-			      functions that create and manipulate on 'IORefs'.
-			.
-			   * "Test.IOSpec.MVar": a pure specification of most
-			      functions that create and manipulate and 'MVars'.
-			.
-			   * "Test.IOSpec.STM": a pure specification of
-			      'atomically' and the 'STM' monad.
-			.
-			   * "Test.IOSpec.Teletype": a pure specification of
-			      'getChar', 'putChar', and several related
-			      Prelude functions.
-			.
-			Besides these modules containing the specifications,
-			there are a few other important modules:
-			.
-			   * "Test.IOSpec.Types": defines the 'IOSpec' type and
-			     several amenities.
-			.
-			   * "Test.IOSpec.VirtualMachine": defines a virtual
-			     machine on which to execute pure specifications.
-			.
-			   * "Test.IOSpec.Surrogate": a drop-in replacement for
-			     the other modules. Import this and recompile your
-			     code once you've finished testing and debugging.
-			.
-			There are several well-documented examples included 
-			with the source distribution.
-Category:       	Testing
-Build-Type:		Simple
-Build-Depends:  	base >= 4.8.0.0 && < 5, mtl, QuickCheck >= 2 && < 3, Stream
-Extensions:		MultiParamTypeClasses, OverlappingInstances
-Ghc-options:		-Wall
-Hs-source-dirs:		src
-Extra-source-files:	README
-			, examples/Channels.hs
-			, examples/Echo.hs
-			, examples/Queues.hs
-			, examples/Refs.hs
-			, examples/Sudoku.hs
-Exposed-modules:	Test.IOSpec
-			, Test.IOSpec.Fork
-			, Test.IOSpec.IORef
-			, Test.IOSpec.MVar
-			, Test.IOSpec.STM
-			, Test.IOSpec.Surrogate
-			, Test.IOSpec.Teletype
-			, Test.IOSpec.Types
-			, Test.IOSpec.VirtualMachine
+Name:            IOSpec
+Version:         0.3.1
+License:         BSD3
+License-file:    LICENSE
+Cabal-Version:    >= 1.2
+Author:          Wouter Swierstra, Yusaku Hashimoto, Nikolay Amiantov
+Maintainer:      Wouter Swierstra <w.s.swierstra@uu.nl>                        
+Synopsis:        A pure specification of the IO monad.
+Description:     This package consists of several modules, that give a
+                 pure specification of functions in the IO monad:
+                   * "Test.IOSpec.Fork": a pure specification of
+                      'forkIO'.
+                   * "Test.IOSpec.IORef": a pure specification of most
+                     functions that create and manipulate on 'IORefs'.
+                   * "Test.IOSpec.MVar": a pure specification of most
+                     functions that create and manipulate and 'MVars'.
+                   * "Test.IOSpec.STM": a pure specification of
+                     'atomically' and the 'STM' monad.
+                   * "Test.IOSpec.Teletype": a pure specification of
+                      'getChar', 'putChar', and several related
+                      Prelude functions.
+                 Besides these modules containing the specifications,
+                 there are a few other important modules:
+                    * "Test.IOSpec.Types": defines the 'IOSpec' type and
+                      several amenities.
+                    * "Test.IOSpec.VirtualMachine": defines a virtual
+                      machine on which to execute pure specifications.
+                    * "Test.IOSpec.Surrogate": a drop-in replacement for
+                      the other modules. Import this and recompile your
+                      code once you've finished testing and debugging.
+                 There are several well-documented examples included 
+                 with the source distribution.
+Category:        Testing
+Build-Type:      Simple
+Extra-source-files:  README
+      , examples/Channels.hs
+      , examples/Echo.hs
+      , examples/Queues.hs
+      , examples/Refs.hs
+      , examples/Sudoku.hs
+library                        
+    Build-Depends:    base >= 4.8.0.0 && < 5, mtl, QuickCheck >= 2 && < 3, Stream
+    Extensions:       MultiParamTypeClasses, OverlappingInstances
+    Ghc-options:      -Wall
+    Hs-source-dirs:   src
+    Exposed-modules:  Test.IOSpec
+      , Test.IOSpec.Fork
+      , Test.IOSpec.IORef
+      , Test.IOSpec.MVar
+      , Test.IOSpec.STM
+      , Test.IOSpec.Surrogate
+      , Test.IOSpec.Teletype
+      , Test.IOSpec.Types
+      , Test.IOSpec.VirtualMachine
 
diff --git a/src/Test/IOSpec/IORef.hs b/src/Test/IOSpec/IORef.hs
--- a/src/Test/IOSpec/IORef.hs
+++ b/src/Test/IOSpec/IORef.hs
@@ -61,7 +61,7 @@
   step (NewIORef d t)     = do loc <- alloc
                                updateHeap loc d
                                return (Step (t loc))
-  step (ReadIORef l t)    = do Just d <- lookupHeap l
+  step (ReadIORef l t)    = do lookupHeap l >>= \(Just d) -> do
                                return (Step (t d))
   step (WriteIORef l d t) = do updateHeap l d
                                return (Step t)
diff --git a/src/Test/IOSpec/STM.hs b/src/Test/IOSpec/STM.hs
--- a/src/Test/IOSpec/STM.hs
+++ b/src/Test/IOSpec/STM.hs
@@ -122,7 +122,7 @@
   updateHeap loc d
   executeSTM (io loc)
 executeSTM (ReadTVar l io)    = do
-  (Just d) <- lookupHeap l
+  lookupHeap l >>= \(Just d) -> do
   executeSTM (io d)
 executeSTM (WriteTVar l d io) = do
   updateHeap l d
