fix collision detection when moving backwards