fixing bug with api calls