Fixed a lot of build-script bugs
Merge branch 'master' into 16