fix wrong calculating