Fixes for Python3 compatibility.