Fix helper makeTreeArray method