Fixed a couple of bugs with improper use of mutexes which caused
intermittent signal distortions.