fix error in y_rep computation