fix build script bugs