fix problem with legend for P3 and P4