Fixes to build system