Fix python2/3 compatibility