fix make_tree with const char ptr
moving implementation in cpp