fix 'order by' containing null values