To improve and simplify compatibility with python3
To improve and simplify compatibility with python3