bug in upsert kv