added logging for replace