Fix sync bug.
Fix tests.