Fixed XML save error

The previous commit introduced a bug corrupting the saved
files. Should be fixed now