Fixed sync bug related to encoding