fix unmanagement of managed window and unmanaged window