update median calculation slightly