faster inverse permutation