BUG: replace() alters unrelated values

closes #7140