fix loop bounds in papi script