Adding modification for Python 3 compatibility