fix bug in get_agent