Feature/syncdb adapt 2

Rebased from https://github.com/leapcode/bitmask_client/pull/600