Fixes N-1 problem in clustering BUT needs to be checked by original developer if possible

Please check reasoning behind this code to ensure we're not
introducing another bug.

  NOTE:
!EQUAL(base->shape.values[i], "")
  should change to
EQUAL(base->shape.values[i], "")
  but becomes a noop!