remove duplicate $keys. refs bceffd