fixed bug on legend