Fixed memory leak deleting agents.