Improved numerical stability of reweight().