fix bugs in streams