Fix bug with sorting of virtual columns

Certain non-local fields would raise errors when checked for sorting instructions.