Fix foo= and ~foo sdb_sync issue and simplify sdb_hash()