Fixed the bug which occurs when sort key is expression rather than column.
Fixed type determinant.