fix broken stream management