diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Changelog for the [`clash-lib`](http://hackage.haskell.org/package/clash-lib) package
 
+## 0.5.10 *August 2nd 2015*
+* Fixes bugs:
+  * Make testbench generation deterministic
+  * Compile against unbound-generics-0.2
+
 ## 0.5.9 *July 9th 2015*
 * Fixes bugs:
   * `coreView` didn't look through newtypes of the form: `newtype Foo a = MkFoo (Maybe a)`
diff --git a/clash-lib.cabal b/clash-lib.cabal
--- a/clash-lib.cabal
+++ b/clash-lib.cabal
@@ -1,5 +1,5 @@
 Name:                 clash-lib
-Version:              0.5.9
+Version:              0.5.10
 Synopsis:             CAES Language for Synchronous Hardware - As a Library
 Description:
   CλaSH (pronounced ‘clash’) is a functional hardware description language that
@@ -74,7 +74,7 @@
                       text                    >= 0.11.3.1,
                       time                    >= 1.4.0.1,
                       transformers            >= 0.3.0.0,
-                      unbound-generics        >= 0.1,
+                      unbound-generics        >= 0.1 && < 0.3,
                       unordered-containers    >= 0.2.3.3,
                       uu-parsinglib           >= 2.8.1,
                       wl-pprint-text          >= 1.1.0.0
diff --git a/src/CLaSH/Driver/TestbenchGen.hs b/src/CLaSH/Driver/TestbenchGen.hs
--- a/src/CLaSH/Driver/TestbenchGen.hs
+++ b/src/CLaSH/Driver/TestbenchGen.hs
@@ -13,7 +13,7 @@
 import qualified Data.HashMap.Lazy                as HashMap
 import           Data.List                        (find,nub)
 import           Data.Maybe                       (catMaybes,mapMaybe)
-import           Data.Text.Lazy                   (append,isPrefixOf,pack,splitOn)
+import           Data.Text.Lazy                   (append,pack,splitOn)
 import           Unbound.Generics.LocallyNameless (name2String)
 
 import           CLaSH.Core.Term
@@ -190,8 +190,8 @@
 genStimuli cmpCnt primMap globals typeTrans tcm normalizeSignal hidden inp modName dfiles signalNm = do
   let stimNormal = normalizeSignal globals signalNm
   (comps,dfiles',cmpCnt') <- genNetlist (Just cmpCnt) stimNormal primMap tcm typeTrans Nothing modName dfiles signalNm
-  let sigNm   = pack (modName ++ "_") `append` last (splitOn (pack ".") (pack (name2String signalNm))) `append` pack "_"
-      sigComp = case find ((isPrefixOf sigNm) . componentName) comps of
+  let sigNm   = pack (modName ++ "_") `append` last (splitOn (pack ".") (pack (name2String signalNm))) `append` pack "_" `append` (pack (show cmpCnt))
+      sigComp = case find ((== sigNm) . componentName) comps of
                   Just c -> c
                   Nothing -> error $ $(curLoc) ++ "Can't locate component for stimuli gen: " ++ (show $ pack $ name2String signalNm) ++ show (map (componentName) comps)
 
@@ -225,8 +225,8 @@
 genVerifier cmpCnt primMap globals typeTrans tcm normalizeSignal hidden outp modName dfiles signalNm = do
   let stimNormal = normalizeSignal globals signalNm
   (comps,dfiles',cmpCnt') <- genNetlist (Just cmpCnt) stimNormal primMap tcm typeTrans Nothing modName dfiles signalNm
-  let sigNm   = pack (modName ++ "_") `append` last (splitOn (pack ".") (pack (name2String signalNm))) `append` "_"
-      sigComp = case find ((isPrefixOf sigNm) . componentName) comps of
+  let sigNm   = pack (modName ++ "_") `append` last (splitOn (pack ".") (pack (name2String signalNm))) `append` "_" `append` (pack (show cmpCnt))
+      sigComp = case find ((== sigNm) . componentName) comps of
                   Just c -> c
                   Nothing -> error $ $(curLoc) ++ "Can't locate component for Verifier: " ++ (show $ pack $ name2String signalNm) ++ show (map (componentName) comps)
       (cName,hidden',inp,fin) = case sigComp of
diff --git a/src/Unbound/Generics/LocallyNameless/Extra.hs b/src/Unbound/Generics/LocallyNameless/Extra.hs
--- a/src/Unbound/Generics/LocallyNameless/Extra.hs
+++ b/src/Unbound/Generics/LocallyNameless/Extra.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP                   #-}
 {-# LANGUAGE FlexibleInstances     #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 
@@ -5,24 +6,36 @@
 
 module Unbound.Generics.LocallyNameless.Extra where
 
+#if MIN_VERSION_unbound_generics(0,2,0)
+#else
 import Control.DeepSeq
+#endif
 import Data.Hashable                           (Hashable(..),hash)
 import Data.Text                               (Text)
 import GHC.Real                                (Ratio)
 import Unbound.Generics.LocallyNameless.Alpha  (Alpha (..))
+#if MIN_VERSION_unbound_generics(0,2,0)
+#else
 import Unbound.Generics.LocallyNameless.Bind   (Bind (..))
 import Unbound.Generics.LocallyNameless.Embed  (Embed (..))
+#endif
 import Unbound.Generics.LocallyNameless.Name   (Name (..))
+#if MIN_VERSION_unbound_generics(0,2,0)
+#else
 import Unbound.Generics.LocallyNameless.Rebind (Rebind (..))
 import Unbound.Generics.LocallyNameless.Rec    (Rec,unrec)
+#endif
 import Unbound.Generics.LocallyNameless.Subst  (Subst (..))
 
+#if MIN_VERSION_unbound_generics(0,2,0)
+#else
 instance (NFData a, NFData b) => NFData (Bind a b)
 instance NFData a => NFData (Embed a)
 instance NFData (Name a)
 instance (NFData a, NFData b) => NFData (Rebind a b)
 instance (Alpha a, NFData a) => NFData (Rec a) where
   rnf r = seq (rnf (unrec r)) ()
+#endif
 
 instance Subst b (Ratio a) where
   subst  _ _ = id
@@ -32,8 +45,11 @@
   hashWithSalt salt (Fn str int) = hashWithSalt salt (hashWithSalt (hash int) str)
   hashWithSalt salt (Bn i0  i1)  = hashWithSalt salt (hash i0 `hashWithSalt` i1)
 
+#if MIN_VERSION_unbound_generics(0,2,0)
+#else
 instance (Ord a) => Ord (Embed a) where
   compare (Embed a) (Embed b) = compare a b
+#endif
 
 instance Alpha Text where
   aeq' _ctx             = (==)
