Thanks :) Reading everything into a variable was not an option, due to some very large files. Creating the iterator only once, as Fredrik suggested, solved the problem nicely. Again many thanks for your great support!