fixed a bug when main window was not visible but visible values was true