Some fixes to the build system