Fixed a bug with the main window visibility