fixed upsert method. it was backwards.