Query fix, helping Oracle dev

Apparently '' == NULL, and query gives different result
Fixing tag ordering

Querying had order messed up when the same tag was with different parents.
Merge remote-tracking branch 'upstream/master'