get proper replacements in some extreme cases

This improves the results in some extreme cases.