correct bug for the case of duplicated char in target