Fix adding duplicate keys