fixed crashing exception caused by nonexisting branches in RoleAPI