Fix #267.  Fix selection-based sort operation.