fix bug which causes stream closed exception on internal buffer's end.