Fixed some calculations