fix using same function in order by clause as in output columns