Backport master fixes to remove cdbsync dependencies

See #41 and #45