added method to prevent delete elements with childs