diff --git a/src-derived/AG2AspectAG.hs b/src-derived/AG2AspectAG.hs
--- a/src-derived/AG2AspectAG.hs
+++ b/src-derived/AG2AspectAG.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (AG2AspectAG.ag)
+-- UUAGC 0.9.35 (AG2AspectAG.ag)
 module AG2AspectAG where
 {-# LINE 7 "AG2AspectAG.ag" #-}
 
diff --git a/src-derived/AbstractSyntax.hs b/src-derived/AbstractSyntax.hs
--- a/src-derived/AbstractSyntax.hs
+++ b/src-derived/AbstractSyntax.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (AbstractSyntax.ag)
+-- UUAGC 0.9.35 (AbstractSyntax.ag)
 module AbstractSyntax where
 {-# LINE 2 "AbstractSyntax.ag" #-}
 
diff --git a/src-derived/AbstractSyntaxDump.hs b/src-derived/AbstractSyntaxDump.hs
--- a/src-derived/AbstractSyntaxDump.hs
+++ b/src-derived/AbstractSyntaxDump.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (AbstractSyntaxDump.ag)
+-- UUAGC 0.9.35 (AbstractSyntaxDump.ag)
 module AbstractSyntaxDump where
 {-# LINE 6 "AbstractSyntaxDump.ag" #-}
 
diff --git a/src-derived/Code.hs b/src-derived/Code.hs
--- a/src-derived/Code.hs
+++ b/src-derived/Code.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (Code.ag)
+-- UUAGC 0.9.35 (Code.ag)
 module Code where
 {-# LINE 2 "Code.ag" #-}
 
diff --git a/src-derived/CodeSyntax.hs b/src-derived/CodeSyntax.hs
--- a/src-derived/CodeSyntax.hs
+++ b/src-derived/CodeSyntax.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (CodeSyntax.ag)
+-- UUAGC 0.9.35 (CodeSyntax.ag)
 module CodeSyntax where
 {-# LINE 2 "CodeSyntax.ag" #-}
 
diff --git a/src-derived/CodeSyntaxDump.hs b/src-derived/CodeSyntaxDump.hs
--- a/src-derived/CodeSyntaxDump.hs
+++ b/src-derived/CodeSyntaxDump.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (CodeSyntaxDump.ag)
+-- UUAGC 0.9.35 (CodeSyntaxDump.ag)
 module CodeSyntaxDump where
 {-# LINE 5 "CodeSyntaxDump.ag" #-}
 
diff --git a/src-derived/ConcreteSyntax.hs b/src-derived/ConcreteSyntax.hs
--- a/src-derived/ConcreteSyntax.hs
+++ b/src-derived/ConcreteSyntax.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (ConcreteSyntax.ag)
+-- UUAGC 0.9.35 (ConcreteSyntax.ag)
 module ConcreteSyntax where
 {-# LINE 2 "ConcreteSyntax.ag" #-}
 
diff --git a/src-derived/DeclBlocks.hs b/src-derived/DeclBlocks.hs
--- a/src-derived/DeclBlocks.hs
+++ b/src-derived/DeclBlocks.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (DeclBlocks.ag)
+-- UUAGC 0.9.35 (DeclBlocks.ag)
 module DeclBlocks where
 {-# LINE 2 "DeclBlocks.ag" #-}
 
diff --git a/src-derived/DefaultRules.hs b/src-derived/DefaultRules.hs
--- a/src-derived/DefaultRules.hs
+++ b/src-derived/DefaultRules.hs
@@ -1,6 +1,6 @@
 {-# OPTIONS_GHC -XBangPatterns #-}
 
--- UUAGC 0.9.34 (DefaultRules.ag)
+-- UUAGC 0.9.35 (DefaultRules.ag)
 module DefaultRules where
 {-# LINE 10 "DefaultRules.ag" #-}
 
diff --git a/src-derived/Desugar.hs b/src-derived/Desugar.hs
--- a/src-derived/Desugar.hs
+++ b/src-derived/Desugar.hs
@@ -1,6 +1,6 @@
 {-# OPTIONS_GHC -XBangPatterns #-}
 
--- UUAGC 0.9.34 (Desugar.ag)
+-- UUAGC 0.9.35 (Desugar.ag)
 module Desugar where
 {-# LINE 13 "Desugar.ag" #-}
 
diff --git a/src-derived/ErrorMessages.hs b/src-derived/ErrorMessages.hs
--- a/src-derived/ErrorMessages.hs
+++ b/src-derived/ErrorMessages.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (ErrorMessages.ag)
+-- UUAGC 0.9.35 (ErrorMessages.ag)
 module ErrorMessages where
 {-# LINE 2 "ErrorMessages.ag" #-}
 
diff --git a/src-derived/Expression.hs b/src-derived/Expression.hs
--- a/src-derived/Expression.hs
+++ b/src-derived/Expression.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (Expression.ag)
+-- UUAGC 0.9.35 (Expression.ag)
 module Expression where
 {-# LINE 2 "Expression.ag" #-}
 
diff --git a/src-derived/GenerateCode.hs b/src-derived/GenerateCode.hs
--- a/src-derived/GenerateCode.hs
+++ b/src-derived/GenerateCode.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (GenerateCode.ag)
+-- UUAGC 0.9.35 (GenerateCode.ag)
 module GenerateCode where
 {-# LINE 9 "GenerateCode.ag" #-}
 
diff --git a/src-derived/HsToken.hs b/src-derived/HsToken.hs
--- a/src-derived/HsToken.hs
+++ b/src-derived/HsToken.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (HsToken.ag)
+-- UUAGC 0.9.35 (HsToken.ag)
 module HsToken where
 {-# LINE 2 "HsToken.ag" #-}
 
diff --git a/src-derived/Interfaces.hs b/src-derived/Interfaces.hs
--- a/src-derived/Interfaces.hs
+++ b/src-derived/Interfaces.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (Interfaces.ag)
+-- UUAGC 0.9.35 (Interfaces.ag)
 module Interfaces where
 {-# LINE 2 "Interfaces.ag" #-}
 
diff --git a/src-derived/InterfacesRules.hs b/src-derived/InterfacesRules.hs
--- a/src-derived/InterfacesRules.hs
+++ b/src-derived/InterfacesRules.hs
@@ -1,6 +1,6 @@
 {-# OPTIONS_GHC -XBangPatterns #-}
 
--- UUAGC 0.9.34 (InterfacesRules.lag)
+-- UUAGC 0.9.35 (InterfacesRules.lag)
 module InterfacesRules where
 {-# LINE 10 "InterfacesRules.lag" #-}
 
diff --git a/src-derived/Order.hs b/src-derived/Order.hs
--- a/src-derived/Order.hs
+++ b/src-derived/Order.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (Order.ag)
+-- UUAGC 0.9.35 (Order.ag)
 module Order where
 {-# LINE 9 "Order.ag" #-}
 
diff --git a/src-derived/Patterns.hs b/src-derived/Patterns.hs
--- a/src-derived/Patterns.hs
+++ b/src-derived/Patterns.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (Patterns.ag)
+-- UUAGC 0.9.35 (Patterns.ag)
 module Patterns where
 {-# LINE 2 "Patterns.ag" #-}
 
diff --git a/src-derived/PrintCode.hs b/src-derived/PrintCode.hs
--- a/src-derived/PrintCode.hs
+++ b/src-derived/PrintCode.hs
@@ -1,6 +1,6 @@
 {-# OPTIONS_GHC -XBangPatterns #-}
 
--- UUAGC 0.9.34 (PrintCode.ag)
+-- UUAGC 0.9.35 (PrintCode.ag)
 module PrintCode where
 {-# LINE 10 "PrintCode.ag" #-}
 
diff --git a/src-derived/PrintErrorMessages.hs b/src-derived/PrintErrorMessages.hs
--- a/src-derived/PrintErrorMessages.hs
+++ b/src-derived/PrintErrorMessages.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (PrintErrorMessages.ag)
+-- UUAGC 0.9.35 (PrintErrorMessages.ag)
 module PrintErrorMessages where
 {-# LINE 4 "PrintErrorMessages.ag" #-}
 
diff --git a/src-derived/PrintOcamlCode.hs b/src-derived/PrintOcamlCode.hs
--- a/src-derived/PrintOcamlCode.hs
+++ b/src-derived/PrintOcamlCode.hs
@@ -1,6 +1,6 @@
 {-# OPTIONS_GHC -XBangPatterns #-}
 
--- UUAGC 0.9.34 (PrintOcamlCode.ag)
+-- UUAGC 0.9.35 (PrintOcamlCode.ag)
 module PrintOcamlCode where
 {-# LINE 10 "PrintOcamlCode.ag" #-}
 
diff --git a/src-derived/PrintVisitCode.hs b/src-derived/PrintVisitCode.hs
--- a/src-derived/PrintVisitCode.hs
+++ b/src-derived/PrintVisitCode.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (PrintVisitCode.ag)
+-- UUAGC 0.9.35 (PrintVisitCode.ag)
 module PrintVisitCode where
 {-# LINE 10 "PrintVisitCode.ag" #-}
 
diff --git a/src-derived/SemHsTokens.hs b/src-derived/SemHsTokens.hs
--- a/src-derived/SemHsTokens.hs
+++ b/src-derived/SemHsTokens.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (SemHsTokens.ag)
+-- UUAGC 0.9.35 (SemHsTokens.ag)
 module SemHsTokens where
 {-# LINE 4 "SemHsTokens.ag" #-}
 
diff --git a/src-derived/TfmToVisage.hs b/src-derived/TfmToVisage.hs
--- a/src-derived/TfmToVisage.hs
+++ b/src-derived/TfmToVisage.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (TfmToVisage.ag)
+-- UUAGC 0.9.35 (TfmToVisage.ag)
 module TfmToVisage where
 {-# LINE 8 "TfmToVisage.ag" #-}
 
diff --git a/src-derived/Transform.hs b/src-derived/Transform.hs
--- a/src-derived/Transform.hs
+++ b/src-derived/Transform.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (Transform.ag)
+-- UUAGC 0.9.35 (Transform.ag)
 module Transform where
 {-# LINE 8 "Transform.ag" #-}
 
@@ -276,7 +276,7 @@
              ++ Map.findWithDefault [] con (Map.findWithDefault Map.empty nt allInsts)
              -- may have duplicates
 
-    groups = Map.assocs $ Map.foldWithKey (\i r m -> Map.insertWith (++) r [i] m) Map.empty usMap
+    groups = Map.assocs $ Map.foldrWithKey (\i r m -> Map.insertWith (++) r [i] m) Map.empty usMap
     apply (ref,us) = mkRule ref (findOutField ref) us
     findOutField ref = case [ chld | (chld,NT tp _) <- fields, tp `hasSyn` ref] of
                          []    -> _LHS
diff --git a/src-derived/Visage.hs b/src-derived/Visage.hs
--- a/src-derived/Visage.hs
+++ b/src-derived/Visage.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (Visage.ag)
+-- UUAGC 0.9.35 (Visage.ag)
 module Visage where
 {-# LINE 6 "Visage.ag" #-}
 
diff --git a/src-derived/VisagePatterns.hs b/src-derived/VisagePatterns.hs
--- a/src-derived/VisagePatterns.hs
+++ b/src-derived/VisagePatterns.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (VisagePatterns.ag)
+-- UUAGC 0.9.35 (VisagePatterns.ag)
 module VisagePatterns where
 {-# LINE 2 "VisagePatterns.ag" #-}
 
diff --git a/src-derived/VisageSyntax.hs b/src-derived/VisageSyntax.hs
--- a/src-derived/VisageSyntax.hs
+++ b/src-derived/VisageSyntax.hs
@@ -1,6 +1,6 @@
 
 
--- UUAGC 0.9.34 (VisageSyntax.ag)
+-- UUAGC 0.9.35 (VisageSyntax.ag)
 module VisageSyntax where
 {-# LINE 2 "VisageSyntax.ag" #-}
 
diff --git a/src/Scanner.hs b/src/Scanner.hs
--- a/src/Scanner.hs
+++ b/src/Scanner.hs
@@ -1,5 +1,5 @@
-{-# OPTIONS -fglasgow-exts #-}
-
+{-# LANGUAGE MagicHash,
+             UnboxedTuples #-}
 module Scanner where
 import GHC.Prim
 import TokenDef
diff --git a/src/TokenDef.hs b/src/TokenDef.hs
--- a/src/TokenDef.hs
+++ b/src/TokenDef.hs
@@ -1,4 +1,6 @@
-{-# OPTIONS -fglasgow-exts #-}
+{-# LANGUAGE MagicHash,
+             UnboxedTuples #-}
+
 module TokenDef where
 
 import GHC.Prim
diff --git a/src/Version.hs b/src/Version.hs
--- a/src/Version.hs
+++ b/src/Version.hs
@@ -1,4 +1,4 @@
 module Version where
 
 banner :: String
-banner = "Attribute Grammar compiler / HUT project. Version 0.9.35"
+banner = "Attribute Grammar compiler / HUT project. Version 0.9.36"
diff --git a/uuagc.cabal b/uuagc.cabal
--- a/uuagc.cabal
+++ b/uuagc.cabal
@@ -1,7 +1,7 @@
 cabal-version: >=1.2
 build-type: Simple
 name: uuagc
-version: 0.9.35
+version: 0.9.36
 license: GPL
 license-file: LICENSE
 maintainer: Arie Middelkoop <ariem@cs.uu.nl>
diff --git a/uuagc.cabal-for-ghc-6.6 b/uuagc.cabal-for-ghc-6.6
--- a/uuagc.cabal-for-ghc-6.6
+++ b/uuagc.cabal-for-ghc-6.6
@@ -1,5 +1,5 @@
 name: uuagc
-version: 0.9.35
+version: 0.9.36
 license: GPL
 license-file: LICENSE
 maintainer: Arie Middelkoop <ariem@cs.uu.nl>
