fixed some bugs, but still have two more bugs