added error handler if problem with read stream