Fixed bug in deleting nodes.