fixes inspired from https://gitlab.cern.ch/lhcb/Moore/-/blob/b2oc_upgrade/Hlt/Hlt2Conf/python/Hlt2Conf/lines/generic_lines_thor/generic_lines.py#L143-L162