Fixed memory leaks in BST