fixed some bugs, more testing required