fixed an error in deleteNodes()