Fixed some bugs(agent)