Attempting to fix flaky tests (#268)
A better check for ArrayIterator and its subclasses.