Updated tests to work with Pythin 3, fixed one Python 3 bug.