Fixed bug in BST decoder