Fix synchronization bugs.