fix some bugs in build.py