correct the node remove function