set commit at the very beginning and end