Fixed compatibility issue with py3