Misc fixes to build.sh