Reworked Chi, ChiSquare.
Fixed some bugs introduced by latest works.