fix bug caused by api.py optimize