corrects the sorting by column to avoid sql injection