fixed index error caused by miscalculating max iterations.ffixed repeateveryuntil to be deterministic