py3 compatibility and unit test