modify adaptive sort