bug fix for tag switching in legend