fix todo: get Last child of the XML tree, but only in the case when needed, the code builds upon the bug in other cases :(