updated for python 3