Simplify index access condition in count-objects, pack-redundant