clean up build script and fix new project crash.