Fixed a bug with setting keys.