fixed hasKey bug