I forgot to add the extra condition on ``is_leaf``. This modification is now used.