fix agent bug