Some improvements to registry code.