modified tool.set_perms