several bugs to be fixed (all commented in mainwindow.cpp file)