Fixed bugs in synchronization.