Add correct implementation of chi-square test.