bugfix in game loop