Critical frame related fix in game loop