make some changes to api.py