modified for deleted nodes