Fix median calc.