made compatible with python 3