Fixed sync bugs.