fix problem with legend for P4