fixed mistakes in percentile following logic