fix resolve-permutations, extract-expression, and others