Fix when order column is not named 'sort_order'

Using deterministic ordering with a column not named 'sort_order' breaks stuff. This fixes that issue.