Fixed legend bug