Fixing issue with sorting which fails when different datatypes are given in the sortby list.