More Python3 and pyflakes fixes