diff --git a/fadno-xml.cabal b/fadno-xml.cabal
--- a/fadno-xml.cabal
+++ b/fadno-xml.cabal
@@ -1,5 +1,5 @@
 name:                fadno-xml
-version:             1.2
+version:             1.2.1
 synopsis:            XML/XSD combinators/schemas/codegen
 description:
             Library for generating code from XML schema files, with
@@ -40,7 +40,7 @@
   -- other-modules:
   -- other-extensions:
   build-depends:       Decimal >= 0.4
-                     , base >= 4.9 && < 4.15
+                     , base >= 4.9 && < 4.20
                      , containers >= 0.5
                      , lens >= 4.15
                      , mtl >= 2.2
diff --git a/src/Fadno/Xml/Codegen.hs b/src/Fadno/Xml/Codegen.hs
--- a/src/Fadno/Xml/Codegen.hs
+++ b/src/Fadno/Xml/Codegen.hs
@@ -21,6 +21,7 @@
 import Fadno.Xml.EmitTypes
 import Fadno.Xml.ParseXsd
 import Control.Lens hiding (Choice,element,elements)
+import Control.Monad
 import Control.Monad.State.Strict
 import Control.Monad.Reader
 import qualified Data.Map.Strict as M
diff --git a/src/Fadno/Xml/ParseXsd.hs b/src/Fadno/Xml/ParseXsd.hs
--- a/src/Fadno/Xml/ParseXsd.hs
+++ b/src/Fadno/Xml/ParseXsd.hs
@@ -366,10 +366,12 @@
 
 
 instance Resolvable (Ref (Either ComplexType SimpleType)) where
-    resolve sch (Unresolved f) = Resolved f $ either error id
-                                 ((Left <$> searchRefTarget "Either-ComplexType" complexTypes f sch)
-                                  <|>
-                                  (Right <$> searchRefTarget "Either-SimpleType" simpleTypes f sch))
+    resolve sch (Unresolved f) = Resolved f $
+        case searchRefTarget "Either-ComplexType" complexTypes f sch of
+          Right r -> Left r
+          Left {} -> case searchRefTarget "Either-SimpleType" simpleTypes f sch of
+            Right r -> Right r
+            Left e -> error e
     resolve _ r = r
 
 
diff --git a/src/Fadno/Xml/XParse.hs b/src/Fadno/Xml/XParse.hs
--- a/src/Fadno/Xml/XParse.hs
+++ b/src/Fadno/Xml/XParse.hs
@@ -18,6 +18,7 @@
 import qualified Text.XML.Light.Cursor as C
 
 import Control.Exception
+import Control.Monad
 import Control.Monad.State.Strict hiding (sequence)
 import Control.Monad.Except hiding (sequence)
 import Data.Either
diff --git a/src/Fadno/Xml/XParser.hs b/src/Fadno/Xml/XParser.hs
--- a/src/Fadno/Xml/XParser.hs
+++ b/src/Fadno/Xml/XParser.hs
@@ -22,6 +22,7 @@
 import qualified Text.XML.Light as X
 
 import Control.Exception
+import Control.Monad
 import Control.Monad.State.Strict hiding (sequence)
 import Control.Monad.Except hiding (sequence)
 import Data.Either
