Make key rename more foolproof
Do the same for key add
Merge pull request #191 from mistio/fix_keys

Fix keys (rename and add)