Fixed compatibility issue with Python 2