Fixed a bug when the ids size was an even multiple of maxPerRequest.