logical error on hasKey()

fix the logical error on hasKey().