Fix indexing when skipping sources thate are not the last ones
Correctly deal with nested ipt