fixed the layer toggle in legend