Tweaks for python3 support (without the need for 2to3!)