updated upsert