Various build fixes

These will have to be tested with the build scripts on all platforms
This may be a contentious change. :)