Fix compatibility with python3