Fix for error truncating registry key names

Reported in #701.