fixed some bugs, more to go