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.