Improving Python 3 support.

Fixing some typos and in general trying to get things to run in Python
3.