Fixed problems with calculaton