more fixes for perm script