Fixing the type of table.sort