Work on the build script. bug fixes