serialize bst