Fix various problems in legend print