corrected calculation of sorted values

The wrong variable was being used to calculate the confidence limits in
the most recent version.