Solved data races in pkg/registry

The old version has a data race detected by ``go test -race``.