Fix error in normalization of sort criteria

Patch for issue #101, rough tests included which can be expanded on for full criteria normalization coverage.