fix bug with sorting in grid(TN)