only check sort_mode when its not null