Fixed chi-sq histo-filling code to use the size of the correct vector as max of the filling loop