make the replace function