stable version of reading files in chunks