Fixed replace function of large files;