auto-build.sh resetting the loop count when build happens