Python3 compatibility tweaks.