fixed control flow of game