bug correction, mutex wasn't always unlocked