Fix bug: each tree element should be initialized using make_shared