Solved data races in pkg/registry

The old version has a data race detected by ``go test -race``.
Haha, good point. Still, might as well be future-proof.