Fix replacement logic again.