small changes for python3 compatibility.