Corrected bug in chi2