Minor tweaks for Python3 compatibility.