Add some more locks where needed.