Corrected bug in chi squared calculator.