adapt to python3