add more robust normalizeUIKeys

[fixes #914]