api call works correctly for any number of results