fixed empty tree bug