fix compatibility with Python 3