fixing game loop