fixed a bug that lead to added child nodes being written multiple times