create stream only if necessary