commit should be outside the loop
bug fix and increase submit attempt count