The fix Commit

The last 6 commits have been an attempt to fix the errors when syncing
across devices.  This commit should rectify the problem.