Fixed several calculations.