Fixed the formula to compute weights of objects