Fix a bug with recursive mutex.