some functions for bstree