update to permutation and optimizer