Fix issues with subwindows opened inside other windows