table: improve sorting