Use the correct field type when sorting.