Fix bug in APIProvider