Implemented correct replacement for elements with non-unique CSS path.