fix py3 functionality