fix incorrect secondary ip handling, fixes #7724

This should provides a fix for issue #7724. Small change, ran make tests and they passed:

Ran 162 tests in 4.690s
OK