changed for python2 compatibility