update tree maker to make it more robust