added some error checking to addpermission