First of all, In BIKI, allGroups command is not supposed to return groups of sideLogic...
and,
allUnits except agents, dead and waiting for respawn units, which is fine!
but these commands take into account the group (in allGroups) and their unit (in allUnits) for any support module or BI module headquarter entity... list not exhaustive
That can ruin any count for groups and units, and lead to weird behavior (enemies attacking nothing!).