make querying empty trees safe