Fix double upsert call