bug fixing in py3