Fix segfault in sdb_sync