fixed some bugs in build scripts