Fixed a couple PY3K incompatibilities.

There are still work to be done, but this is a start.