A (potential) bug of the field of indices of batch

I am trying to print the original target and source sequene out during training. I just follow the implementation in translation.py:

for b in batch.batch_size:

But I got the error of IndexError: list index out of range. I print batch.indices and found there are some values larger than len(batch.dataset.examples), which is problematic. And then I found there is a filter_out that filter the examples. But after that, the indices is not re-arange to 0~len(examples). Is it a bug or I misunderstood it? Otherwise, how can I extract the correspoding original source and target of the current batch. Thanks a lot!