Fix a bug when multiple replacement strings were in the same value.