Py3 compatibility changes
Updated tests