More fixes for R-squared calculations