Fixed to use iostat instead of 'err=' in read().