Verify key type instead of value

This is to make the code cleaner and easier to understand