Some bug-fixes and enhancements to build-process