Bugzilla 50626: Fix potential performance issue when adding nodes. Thanks to mkoegler.AT.auto.tuwien.ac.at.