diff --git a/dataframe-core.cabal b/dataframe-core.cabal
--- a/dataframe-core.cabal
+++ b/dataframe-core.cabal
@@ -1,6 +1,6 @@
 cabal-version:      2.4
 name:               dataframe-core
-version:            1.1.0.3
+version:            1.1.0.4
 synopsis:           Core data structures for the dataframe library.
 description:
     Minimal interchange-format types for the @dataframe@ ecosystem:
diff --git a/src/DataFrame/Display/Terminal/Colours.hs b/src/DataFrame/Display/Terminal/Colours.hs
--- a/src/DataFrame/Display/Terminal/Colours.hs
+++ b/src/DataFrame/Display/Terminal/Colours.hs
@@ -1,14 +1,7 @@
 module DataFrame.Display.Terminal.Colours where
 
--- terminal color functions
-red :: String -> String
-red s = "\ESC[31m" ++ s ++ "\ESC[0m"
-
-green :: String -> String
-green s = "\ESC[32m" ++ s ++ "\ESC[0m"
-
-brightGreen :: String -> String
-brightGreen s = "\ESC[92m" ++ s ++ "\ESC[0m"
-
-brightBlue :: String -> String
-brightBlue s = "\ESC[94m" ++ s ++ "\ESC[0m"
+red, green, brightGreen, brightBlue :: String -> String
+red = id
+green = id
+brightGreen = id
+brightBlue = id
diff --git a/src/DataFrame/Internal/AggPlan.hs b/src/DataFrame/Internal/AggPlan.hs
--- a/src/DataFrame/Internal/AggPlan.hs
+++ b/src/DataFrame/Internal/AggPlan.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE AllowAmbiguousTypes #-}
 {-# LANGUAGE BangPatterns #-}
 {-# LANGUAGE ExplicitNamespaces #-}
 {-# LANGUAGE GADTs #-}
@@ -50,7 +51,7 @@
     Expr (..),
     UExpr (..),
  )
-import Type.Reflection (typeRep)
+import Type.Reflection (Typeable, typeRep)
 
 {- | The plan 'planAgg' produces for a recognised output expression. The median
 plan carries only the column name (the holistic grouped sort lives in the
@@ -70,7 +71,7 @@
 clean unboxed vector.
 -}
 planAgg :: GroupedDataFrame -> UExpr -> Maybe AggPlan
-planAgg gdf (UExpr expr) = case expr of
+planAgg gdf (UExpr (expr :: Expr a)) = case expr of
     Agg (FoldAgg tag _ _) (Col name) -> foldPlan tag name
     Agg (MergeAgg tag _ _ _ _) (Col name) -> mergePlan tag name
     Agg (CollectAgg tag _) (Col name) -> collectPlan tag name
@@ -89,9 +90,13 @@
         "maximum" -> require name (PlanScatter RMax name)
         _ -> Nothing
     mergePlan tag name = case tag of
-        "mean" -> require name (PlanScatter RMean name)
-        "count" -> require name (PlanScatter RCount name)
+        "mean" -> outputType @Double >> require name (PlanScatter RMean name)
+        "count" -> outputType @Int >> require name (PlanScatter RCount name)
         _ -> Nothing
+    outputType :: forall t. (Typeable t) => Maybe ()
+    outputType = case testEquality (typeRep @a) (typeRep @t) of
+        Just Refl -> Just ()
+        Nothing -> Nothing
     collectPlan tag name = case tag of
         "stddev" -> require name (PlanScatter RStd name)
         "variance" -> require name (PlanScatter RVar name)
