repair fun nth_replace