fix bug in fread error checking