Updated error catching for stream