double free memory corruption in agent fixed