perform replace() in background