fixed main activity calculations