Fix crash with unexpected registry key values.