SP columns activating without input when using topology

Thanks @Vovchik, you got me looking in the right place. I think the problem can be fixed quite simply by adding one more condition to the if statement below:

As-is, this condition will select winner columns that have no overlap with the input vector. I believe one more condition needs to be added so the code looks like this:

  if overlaps[i] > 0 and numBigger < numActive:

See it working with this change: