When the Flags column is included in a query, the individual flag values are arbitrarily joined together. The result of this is that sorting on this column is inconsistent.
Committed fix to CVS. Should be fixed in the next update.