Fix orphan-removal in XML driver
Merge pull request #951