Fix unit tests

More unit test fixes. Most of these have to do with Python 3.x compatibility.