Fix global variable leak in MockAgent.