diff --git a/configure.ac b/configure.ac
index 1889217..add3383 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,6 +217,7 @@ AC_CONFIG_FILES(
   pygobject-2.0.pc
   pygobject-2.0-uninstalled.pc
   codegen/Makefile
+  codegen/libcodegen/Makefile
   codegen/pygobject-codegen-2.0
   docs/Makefile
   docs/reference/entities.docbook
diff --git a/dsextras.py b/dsextras.py
index 9fc79c1..70f3eb9 100644
--- a/dsextras.py
+++ b/dsextras.py
@@ -107,8 +107,8 @@ class BuildExt(build_ext):
             msnative_struct = { '2' : '-fnative-struct',
                                 '3' : '-mms-bitfields' }
             gcc_version = getoutput('gcc -dumpversion')
-            print 'using MinGW GCC version %s with %s option' % \
-                  (gcc_version, msnative_struct[gcc_version[0]])
+            sys.stdout.write('using MinGW GCC version %s with %s option\n' % \
+                  (gcc_version, msnative_struct[gcc_version[0]]))
             self.extra_compile_args.append(msnative_struct[gcc_version[0]])
 
     def modify_compiler(self):
@@ -276,8 +276,8 @@ class PkgConfigExtension(Extension):
         for package, version in reqs:
             retval = os.system('pkg-config --exists %s' % package)
             if retval:
-                print ("* %s.pc could not be found, bindings for %s"
-                       " will not be built." % (package, self.name))
+                sys.stdout.write("* %s.pc could not be found, bindings for %s"
+                       " will not be built.\n" % (package, self.name))
                 self.can_build_ok = 0
                 return 0
 
@@ -288,9 +288,9 @@ class PkgConfigExtension(Extension):
                 self.can_build_ok = 1
                 return 1
             else:
-                print "Warning: Too old version of %s" % self.pkc_name
-                print "         Need %s, but %s is installed" % \
-                      (package, orig_version)
+                sys.stdout.write("Warning: Too old version of %s\n" % self.pkc_name)
+                sys.stdout.write("         Need %s, but %s is installed\n" % \
+                      (package, orig_version))
                 self.can_build_ok = 0
                 return 0
 
@@ -319,7 +319,7 @@ try:
     from codegen.codegen import register_types, SourceWriter, \
          FileOutput
     import codegen.createdefs
-except ImportError, e:
+except ImportError:
     template_classes_enabled=False
 
 class Template(object):
@@ -382,8 +382,8 @@ class Template(object):
             register_types(dp)
 
         if self.load_types:
-            globals = {}
-            execfile(self.load_types, globals)
+            os.spawnlp(os.P_WAIT, sys.executable,
+                       sys.executable, self.load_types)
 
         dp = DefsParser(self.defs,dict(GLOBAL_MACROS))
         dp.startParsing()
diff --git a/pygobject-2.0-uninstalled.pc.in b/pygobject-2.0-uninstalled.pc.in
index 871d7e0..9f96975 100644
--- a/pygobject-2.0-uninstalled.pc.in
+++ b/pygobject-2.0-uninstalled.pc.in
@@ -13,6 +13,6 @@ xslfiles=${pc_top_builddir}/${pcfiledir}/docs/xsl
 # same here.  Useful when calling the code generator in addon packages.
 defsdir=${pc_top_builddir}/${pcfiledir}/.
 fixxref=${pc_top_builddir}/${pcfiledir}/docs/xsl/fixxref.py
-codegendir=${pc_top_builddir}/${pcfiledir}/gobject/codegen
+codegendir=${pc_top_builddir}/${pcfiledir}/codegen
 pygdocs=${pc_top_builddir}/${pcfiledir}/docs
 datadir=${pc_top_builddir}/pygobject-@VERSION@
