fix sort bug