Fixes #5059 - Returns error message when sorting by wrong column.
Merge pull request #4669 from adamruzicka/sort-by-fix

Fixes #5059 - Returns error message when sorting by wrong column