fixed up some bugs