Fix #2377: corrected definition of sortby(v,by,alg).