Don't rename when there is nothing to rename.

When using `rename` on an optional key and such a key does not exist `rename` creates a new key with `undefined` as the value. 

This PR ensures that the there is something to rename and only then creates the new key.