fixed percentile and median functions