diff --git a/HCodecs.cabal b/HCodecs.cabal
--- a/HCodecs.cabal
+++ b/HCodecs.cabal
@@ -1,5 +1,5 @@
 name: HCodecs
-version: 0.2
+version: 0.2.1
 cabal-Version: >= 1.2
 license: BSD3
 license-file: LICENSE
diff --git a/src/Data/Arbitrary.hs b/src/Data/Arbitrary.hs
--- a/src/Data/Arbitrary.hs
+++ b/src/Data/Arbitrary.hs
@@ -13,7 +13,7 @@
 --
 -----------------------------------------------------------------------------
 
-{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleContexts, CPP #-}
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 
 module Data.Arbitrary (
@@ -36,6 +36,9 @@
 
 import System.Random
 
+-- random since 1.0.1.0 defines the following instances
+#if MIN_VERSION_random(1,0,1)
+#else
 
 instance Random Word8 where
   randomR = integralRandomR
@@ -72,6 +75,7 @@
 instance Random Int64 where
   randomR = integralRandomR
   random = randomR (minBound,maxBound)
+#endif
 
 integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)
 integralRandomR  (a,b) g = case randomR (fromIntegral a :: Integer,fromIntegral b :: Integer) g of
diff --git a/src/Data/ByteString/Builder.hs b/src/Data/ByteString/Builder.hs
--- a/src/Data/ByteString/Builder.hs
+++ b/src/Data/ByteString/Builder.hs
@@ -62,7 +62,8 @@
 
   ) where
 
-import Foreign
+import Foreign hiding (unsafePerformIO)
+import System.IO.Unsafe (unsafePerformIO)
 import Data.Monoid
 import qualified Data.ByteString      as S
 import qualified Data.ByteString.Lazy as L
diff --git a/src/Data/ByteString/Parser.hs b/src/Data/ByteString/Parser.hs
--- a/src/Data/ByteString/Parser.hs
+++ b/src/Data/ByteString/Parser.hs
@@ -110,10 +110,10 @@
 import qualified Data.ByteString.Internal as B
 import qualified Data.ByteString.Lazy.Internal as L
 
-import Foreign
+import Foreign hiding (unsafePerformIO)
+import Control.Monad.ST.Unsafe (unsafeInterleaveST)
 
--- used by splitAtST
-import Control.Monad.ST
+import Control.Monad.ST hiding (unsafeInterleaveST)
 import Data.STRef
 
 
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,23 @@
+all: prep
+	ghc -O3 -Wall           -i../src -odir ./tmp -hidir ./tmp --make ../src/Tests/Main.hs -o main
+	./main +RTS -s
+
+prof: prep
+	ghc -O3 -prof -auto-all -i../src -odir ./tmp -hidir ./tmp --make ../src/Tests/Main.hs -o main
+	./main +RTS -p
+
+hpc: prep
+	ghc -fhpc -O3 -i../src -odir ./tmp -hidir ./tmp --make ../src/Tests/Main.hs -o main
+	./main
+	hpc markup main
+
+prep: clean
+	locate *.mid > mid.txt
+	locate *.sf2 > sf2.txt
+	locate *.wav > wav.txt
+	mkdir tmp
+
+clean:
+	rm -rf ./tmp
+	rm -rf .hpc
+	rm -f *.o *.hi *.html *.tix *.aux *.hp *.prof *.ps main mid.txt sf2.txt wav.txt
