fix add error handlers for read and write streams