Fix minor counting bug that could affect ordering of items in results output.