fixed sync bug when using more than one agent