enable ci build on osx
fix some bugs in build.py