fix bug for k-permuation