fix debug logging to match argument order and properly identify variables.
Support PyQt4
Fix QApplication usage