Fix for mysql order by clause bug.