Fixes for iteration over a file multiple times.