upsert and output success fix