fix bug in mse calculation