fixed some bugs in movement