Small tweaks for Python3 compatibility