Fix bug when deleting last child