Fix #1316
Fix #1316
Merge pull request #2516 from Rodsevich/master

Fixes issue #1316 (Ghost windows)