Fixed compatibility with Python 3.