stream: quick fix memory issues, needs further investigation