wrap commit in a transaction