diff --git a/generator/Data/XCB/Python/Parse.hs b/generator/Data/XCB/Python/Parse.hs
--- a/generator/Data/XCB/Python/Parse.hs
+++ b/generator/Data/XCB/Python/Parse.hs
@@ -363,7 +363,7 @@
                                                            , e
                                                            ])]
        CompositeType _ _ -> Right $ [(name',
-                                      mkCall (mkDot e (mkName "pack")) noArgs)]
+                                      mkCall (mkDot e "pack") noArgs)]
 
 -- As near as I can tell here the padding param is unused.
 structElemToPyPack _ m accessor (ValueParam typ mask _ list) =
diff --git a/generator/Data/XCB/Python/PyHelpers.hs b/generator/Data/XCB/Python/PyHelpers.hs
--- a/generator/Data/XCB/Python/PyHelpers.hs
+++ b/generator/Data/XCB/Python/PyHelpers.hs
@@ -83,11 +83,11 @@
 -- | Make an Expr out of a string like "foo.bar" describing the name.
 mkName :: String -> Expr ()
 mkName s =
-  let strings = map mkVar $ reverse $ splitOn "." s
-  in foldr mkDot (head strings) (reverse $ tail strings)
+  let strings = splitOn "." s
+  in foldl mkDot (mkVar $ head strings) (tail strings)
 
-mkDot :: (PseudoExpr a, PseudoExpr b) => a -> b -> Expr ()
-mkDot e1 e2 = BinaryOp (Dot ()) (getExpr e1) (getExpr e2) ()
+mkDot :: PseudoExpr a => a -> String -> Expr ()
+mkDot e1 attr = Dot (getExpr e1) (ident attr) ()
 
 -- | Make an attribute access, i.e. self.<string>.
 mkAttr :: String -> Expr ()
diff --git a/tests/PyHelpersTests.hs b/tests/PyHelpersTests.hs
--- a/tests/PyHelpersTests.hs
+++ b/tests/PyHelpersTests.hs
@@ -29,13 +29,9 @@
 testMkName :: Test
 testMkName =
   let result = mkName "self.foo.bar"
-      expected = BinaryOp (Dot ())
-                          (Var (Ident "self" ()) ())
-                          (BinaryOp (Dot ())
-                                    (Var (Ident "foo" ()) ())
-                                    (Var (Ident "bar" ()) ())
-                                    ())
-                          ()
+      expected = (Dot (Dot (Var (Ident "self" ()) ())
+                           (Ident "foo" ()) ())
+                      (Ident "bar" ()) ())
   in mkTest "testMkName" expected result
 
 testReserves :: Test
diff --git a/xcffib.cabal b/xcffib.cabal
--- a/xcffib.cabal
+++ b/xcffib.cabal
@@ -1,5 +1,5 @@
 name:                xcffib
-version:             0.2.0
+version:             0.2.1
 synopsis:            A cffi-based python binding for X
 homepage:            http://github.com/tych0/xcffib
 license:             OtherLicense
@@ -19,7 +19,7 @@
 library
   build-depends: base ==4.*,
                  xcb-types >= 0.7.0,
-                 language-python >= 0.4.0,
+                 language-python >= 0.5.0,
                  filepath,
                  filemanip,
                  split,
@@ -37,7 +37,7 @@
   hs-source-dirs: generator
   build-depends: base ==4.*,
                  xcffib >= 0.1.0,
-                 language-python >= 0.4.0,
+                 language-python >= 0.5.0,
                  split,
                  xcb-types >= 0.7.0,
                  optparse-applicative >= 0.5,
@@ -56,7 +56,7 @@
   type: exitcode-stdio-1.0
   build-depends: base ==4.*,
                  xcffib >= 0.1.0,
-                 language-python >= 0.4.0,
+                 language-python >= 0.5.0,
                  HUnit,
                  test-framework,
                  test-framework-hunit
@@ -68,7 +68,7 @@
   build-depends: base ==4.*,
                  xcffib >= 0.1.0,
                  xcb-types >= 0.7.0,
-                 language-python >= 0.4.0,
+                 language-python >= 0.5.0,
                  HUnit,
                  test-framework,
                  test-framework-hunit,
