fix the api code