fix up some bugs

fix up some bugs