fixed customReadFile(): properly get number of chunks to read