Fix some bugs on the stream