fixing mutexes and exclusion bugs