Fix activate main window issue