fixed memory issue with large files.