Fix a bug which caused excessive joining of streams