modify for Python 2