Fix repeat logic