fix AttributeError for python 3