fix bug in API call