bytesRead moved to where the variable is actually used
TODO added
Merge branch 'master' into max-file-size_38