Solved data races in pkg/registry

The old version has a data race detected by ``go test -race``.
Maybe just a regular mutex? Or at least switch to using write locks for create/update?