Fix timing in game loop