fixing sort on record search