fix keySet logic