Simplification of fix_key

A small simplification of the fix_key function.