Fixed minor bug in tree view query that caused items to potentially
display out of order.