Updated the code for Python3

Very minor changes.