fix bug with agent logging