fix api did not work in python3