Fix bogus returns when dealing with multiple discrete outputs

When looking for largest activating output, code was incorrect.