Fixed bug in commit looping