Further improved python 3 compatibility.