Refactor a code that check a correct initialization of gates in the
tree.