You are of course correct.

Running `tidy` is of not enough help. I handle the situation by saving into a new file, then copy-paste the changed bits into my hand-crafted SVG and clean them up.

Ideally I try to avoid Inkscape altogether. Which is hard, as it's just too good.