Python 3 compatibility changes

Some simple changes to ensure Python 3 compatibility