adaptation to python3