fix error in legend function