Fix returning stream if requested (Bug #12142)