Fixed bug in remove nodes