finish flatten bst