Corrected a bug that may in certain condition prevent the mainPannel from being displayed.