Fix an issue that caused the player to jump back and forth