Fix compatibility with Python 2.x