Fix Py2/Py3 compatibility.