Fix bug where deleting a node with multiple inputs only deletes the first one