fix StopIteration