Update build script, fix some missing code.