Add a replace hook.