function delete-node slightly updated (not checked)