MainFrame: fix undefined behaviour