added implicit sort order guessing