fix undefined variable in agent
resolve conflicts from merge from devel