Fix bug in end_game