background sync up bug fixes.
Merge branch 'feature/background-sync-to-couchdb' into develop