Revert "Revert "Fixed sync bug""

This reverts commit b127c734b333de9eb7b6ca1970751ed119d71801.