fixed a bug with modperm