Permutations: repair generating next perm