Fixed minor calculation bug