removes unneeded permissions.