fix(Key) Fix incorrect equality calculation.

Fix incorrect equality calculation in the key. Add test to cover for different scenarios.