fixed format of output when replacing synonyms