simplify checking duplicate legend entries