diff --git a/GenTagAST.hs b/GenTagAST.hs
index f60bdad..0ab4ef4 100644
--- a/GenTagAST.hs
+++ b/GenTagAST.hs
@@ -95,7 +95,7 @@ consFor x = map consFor' (dataTypeConstrs $ dataTypeOf x)
     -- The way I work out how many arguments a constructor takes is crazy, but
     -- I can't see a better way given the Data.Generics API
     consFor' :: Constr -> (Int, String)
-    consFor' con = (length (gmapQ (const undefined) (fromConstr con :: a)), showConstr con)
+    consFor' con = (glength (fromConstr con :: a), showConstr con)
 
 consParamsFor :: forall a. Data a => a -> [(Int, String, [String])]
 consParamsFor x = map consParamsFor' (dataTypeConstrs $ dataTypeOf x)
diff --git a/common/TreeUtils.hs b/common/TreeUtils.hs
index af5cc19..6f2800d 100644
--- a/common/TreeUtils.hs
+++ b/common/TreeUtils.hs
@@ -130,7 +130,7 @@ checkMatch m@(Match con items) b
         else (gmapQi index (checkMatch f) d) 
       --Possibly a better way?
       where
-        numIndexes = length (gmapQ (const undefined) d)
+        numIndexes = glength d
 
 
 {-