Fix nonexistent attributes in sort orders