handle return value of fread