Found my bug. It was in the method getIndices() in IndexPair.