The Main window was not always brought to front in all cases