fixes to legend formatting