Stream locking changes

As discussed on the mailing list ...