Fixed py3-related errors in tests.