Fix compatibility with Py3.