Fixes for Python 3 and unit tests.