Fix issue when replacing a path element with another element

Add a method to fully remove an element, and updated logic in various places to use this

Merge request reports

Loading