fix some bugs

hope helps