fixed refreshAgent bug