check for circular legend definitions. fixes #148