fix record sort bug