diff --git a/Data/IntMap/EnumMap.hs b/Data/IntMap/EnumMap.hs
--- a/Data/IntMap/EnumMap.hs
+++ b/Data/IntMap/EnumMap.hs
@@ -40,7 +40,7 @@
 
 {-# INLINE lookup #-}
 lookup :: (Enum key,Monad m) => key -> EnumMap key a -> m a
-lookup k (EnumMap m) = M.lookup (fromEnum k) m
+lookup k (EnumMap m) = maybe (fail "EnumMap.lookup failed") return $ M.lookup (fromEnum k) m
 
 findWithDefault :: (Enum key) => a -> key -> EnumMap key a -> a
 findWithDefault a k (EnumMap m) = M.findWithDefault a (fromEnum k) m
diff --git a/Text/Regex/TDFA.hs b/Text/Regex/TDFA.hs
--- a/Text/Regex/TDFA.hs
+++ b/Text/Regex/TDFA.hs
@@ -51,6 +51,6 @@
 
 getVersion_Text_Regex_TDFA :: Version
 getVersion_Text_Regex_TDFA =
-  Version { versionBranch = [0,94]
+  Version { versionBranch = [0,95,2]
           , versionTags = ["tdfa","unstable"]
           }
diff --git a/regex-tdfa.cabal b/regex-tdfa.cabal
--- a/regex-tdfa.cabal
+++ b/regex-tdfa.cabal
@@ -1,6 +1,6 @@
 Name:                   regex-tdfa
-Version:                0.95.1
--- Cabal-Version:       >=1.1.6
+Version:                0.95.2
+Cabal-Version:          >=1.2
 License:                BSD3
 License-File:           LICENSE
 Copyright:              Copyright (c) 2007, Christopher Kuklewicz
@@ -13,47 +13,40 @@
 Description:            A new all Haskell "tagged" DFA regex engine, inspired by libtre
 Category:               Text
 Tested-With:            GHC
-Build-Depends:          regex-base >= 0.80, base >= 2.0, parsec, mtl, containers, array, bytestring
 Build-Type:             Simple
--- Data-Files:
--- Extra-Source-Files:
--- Extra-Tmp-Files:
-Exposed-Modules:        Text.Regex.TDFA.Common
-                        Text.Regex.TDFA.IntArrTrieSet
-                        Text.Regex.TDFA.TNFA
-                        Text.Regex.TDFA.TDFA
-                        Text.Regex.TDFA.Pattern
-                        Text.Regex.TDFA.ReadRegex
-                        Text.Regex.TDFA.CorePattern
-                        Text.Regex.TDFA.RunMutState
-                        Text.Regex.TDFA.String
-                        Text.Regex.TDFA.MutRun
-                        Text.Regex.TDFA.ByteString
-                        Text.Regex.TDFA.MutRunBS
-                        Text.Regex.TDFA.ByteString.Lazy
-                        Text.Regex.TDFA.MutRunLBS
-                        Text.Regex.TDFA.Sequence
-                        Text.Regex.TDFA.MutRunSeq
-                        Text.Regex.TDFA.Wrap
-                        Text.Regex.TDFA
-                        Data.IntSet.EnumSet
-                        Data.IntMap.EnumMap
-                        Data.IntMap.CharMap
-Buildable:              True
--- Other-Modules:
--- HS-Source-Dirs:         "."
-Extensions:             MultiParamTypeClasses, FunctionalDependencies, BangPatterns, MagicHash, RecursiveDo, NoMonoPatBinds, ForeignFunctionInterface, UnboxedTuples, TypeOperators, FlexibleContexts, ExistentialQuantification, UnliftedFFITypes, TypeSynonymInstances
-GHC-Options:            -Wall -O2 -funbox-strict-fields
--- GHC-Options:            -Wall -O2
--- GHC-Options:            -Wall -ddump-minimal-imports
--- GHC-Prof-Options:       -auto-all
--- Hugs-Options:
--- NHC-Options:
--- Includes:
--- Include-Dirs:
--- C-Sources:
--- Extra-Libraries:
--- Extra-Lib-Dirs:
--- CC-Options:
--- LD-Options:
--- Frameworks:
+
+  
+flag base4
+
+library 
+  if flag(base4)
+    Build-Depends:          regex-base >= 0.80, base >= 4.0, parsec, mtl, containers, array, bytestring, ghc-prim
+  else
+    Build-Depends:          regex-base >= 0.80, base < 4.0, parsec, mtl, containers, array, bytestring
+  Exposed-Modules:        Text.Regex.TDFA.Common
+                          Text.Regex.TDFA.IntArrTrieSet
+                          Text.Regex.TDFA.TNFA
+                          Text.Regex.TDFA.TDFA
+                          Text.Regex.TDFA.Pattern
+                          Text.Regex.TDFA.ReadRegex
+                          Text.Regex.TDFA.CorePattern
+                          Text.Regex.TDFA.RunMutState
+                          Text.Regex.TDFA.String
+                          Text.Regex.TDFA.MutRun
+                          Text.Regex.TDFA.ByteString
+                          Text.Regex.TDFA.MutRunBS
+                          Text.Regex.TDFA.ByteString.Lazy
+                          Text.Regex.TDFA.MutRunLBS
+                          Text.Regex.TDFA.Sequence
+                          Text.Regex.TDFA.MutRunSeq
+                          Text.Regex.TDFA.Wrap
+                          Text.Regex.TDFA
+                          Data.IntSet.EnumSet
+                          Data.IntMap.EnumMap
+                          Data.IntMap.CharMap
+  Buildable:              True
+  Extensions:             MultiParamTypeClasses, FunctionalDependencies, BangPatterns, MagicHash, RecursiveDo, NoMonoPatBinds, ForeignFunctionInterface, UnboxedTuples, TypeOperators, FlexibleContexts, ExistentialQuantification, UnliftedFFITypes, TypeSynonymInstances
+  GHC-Options:            -Wall -O2 -funbox-strict-fields
+  -- GHC-Options:            -Wall -O2
+  -- GHC-Options:            -Wall -ddump-minimal-imports
+  -- GHC-Prof-Options:       -auto-all
