fixed a bug in calculation of rho

fixed a bug