Why is my sort put line 9 second?

I’ve created a report and found some code to add a selectable drop down to the dialog. This part works perfectly. The only strange part is that it sorts it very strange. I’m choosing a Transfer Order and then selecting some or all of the lines from it. If I have an order with 9 or more lines and choose them all, it sorts them like this


If I have an order with 8 lines or less, it sorts them in order. I cannot figure out why.

Here is the code in my UIBuilder

select inventTransferLine
                order by inventTransferLine.LineNum
                where inventTransferLine.TransferId == orderNum;
                DS = query.addDataSource(tableNum(InventTransferLine));
                qbr = DS.addRange(fieldNum(InventTransferLine, TransferId));
                DS.fields().addField(fieldNum(InventTransferLine, LineNum));
                DS.fields().addField(fieldNum(InventTransferLine, ItemId));    
                DS.addOrderByField(fieldNum(InventTransferLine, LineNum));
                selectedLines = [tableNum(InventTransferLine), fieldNum(InventTransferLine, LineNum)];

        SysLookupMultiSelectCtrl::constructWithQuery(this.dialog().dialogForm().formRun(), dialogLines.control(), query, false, selectedLines);



Can someone see in the code if I’m doing something wrong?