Fixed main window bug