Fix KeySet bugs