fixed python2/3 compatibility