fix some py3k compat issue