fixed memory corrupt when node removes itself and gets deleted