fixed the bug that didn't remove edges together with nodes