Bug fix

fix some bugs