Fix sort option handling