A few bugfixes in the build system