fixed legend bug