fix bug when unmanage window