Fixed problem with pagination if API call fails