Bug fix: prevents legend from being shown twice