Fixed the sort function to match the added column in the qictab function