corrected function add/remove of permissions.