added empty tree support