Assorted bug fixes, including duplicate mutex group.