Fix a critical bug (improper usage of QApplication)