Fixed sorting of rows by table's columns