added missing computation of XtX