Tweaks, improved Python3 compatibility