fix some bugs