Made getKeys return a unique array of keys.

This was causing applications to crash if there was somehow thousands of keys, but where most the same.
Merge pull request #4126 from fragglebob/master

Made getKeys return a unique array of keys.