fixing bug with game logic