Fixed a bug where children were removed, that cause a loop over the children to end before it was finished