change return of read fun to insert errors