fix custom sort bug