Fix issues with wms_layer_group printing (#4533)