re-generate legend: fixes

Fixed crash if there was no previous legend.
Fixed ncol inheritance.