fix bugs in synchronizing