Fix infinite loop when fetching all