correction to permutation stack output