Bug fix: incorrect bytes consumed in the stream-buffer