fix compatibility with python3