fix agent not logged in issue