fix some bugs

actually kind of many bugs