Fix bugs in stream.c

Signed-off-by: Thynson <lanxingcan@gmail.com>