fix calculation issues