fixed the legend stuff