Preliminary patch to deal with files with many (more than 2500) scans.