fixed segfault in mainwindow.c