Some python2/3 compability fixes