Fixed some bugs caused by using setup.py