Modified sources to run in Python 3

There's several errors in python 3.