So, this will require more thought. Looking through the code, it's really about "macs_active" and not "ports_active". The "ports_total" is really more akin to what you are looking at. So, there is a bit of a vocab issue here. It's real old code basically.
All values, mentioned by you, i.e. "macs_active" and "ports_total", are already correct. My fix changes only result of "Ports Active", which changes value of "UserPorts Up", and nothing more.
So, this will require more thought. Looking through the code, it's really about "macs_active" and not "ports_active". The "ports_total" is really more akin to what you are looking at. So, there is a bit of a vocab issue here. It's real old code basically.