Work on Python 3 compatibility