Improve support for python3.