fix wrong calculation