better error message for identical replacements