remove unused permissions and terms