delete child2 before child1 to avoid invalid iterators