Fixed sort bug