python2 compat fixes