fix handling of vsync