include connection instance to all streams, and fix state transition