Fix replace sideeffects too.