python3 compatibility fixes

...hopefully for the last time. ;-)