Add locking around GetStream()

Amendment to #4