Fixes merge and replace using return value.