Fixed bug in movement logic