fixing legend stuff