Fixing legend overflow