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

Contains the fix from my comment in issue #4.