bugfix and fixing the BST demo