fix error handle in stream