Fixed some bugs for the synchronization