fixed a bug with proportion calculation.