Connection mutex improvements for issue #59

(I don't see how to connect a PR with an existing issue.) See comments on #59.