Issue #467 fix the table index in the ref table removal