fixing up some bugs