Add a safe method to get a registry value