More general cleanup for bugs moving from 2 to 3 and pyqt4 to pyqt5