BUGFIX: file iterator was not properly reset before use (issues with multiple calls).