Fixed leak in Chi-Squared test