Improve Python3 compatibility.