Fix to Iterator::valid() not using ArrayIterator::Valid and causing infinite loops when last element is filtered