fix NameError in python 3