Changed prepfold_plot to use new chi2 functions.  Fixed bugs in chi2 functions.