Fix bug with sort option