fixed bug with perm removal