Some fixes for windowed mode