(bug) update algorithm to provide repeat value