Bugfix of window mode

fixes #3187