agent: fix up mutexes (mutices?)