Fix condition bug of weights