fixed crash when querying empty tree