modify to avoid file comes to memory