fix a bug that strings which have '$' characters can't be replaced properly.