corrected return value of read function