commit before making buttons programmatically