Complete py3 compatibility