fix a sort bug