fix the missing upsert key a better way