updated to work with python 3

Minor updates to make this compatible with Python 3