fix bug for calculate