! fix bugs in Legend window