Fixes main game loop