Fixed bugs when game ends