Revisit locking in ProfileRegistry fixing potential concurrency issues.