fixed bug with empty tree