Fix miscalculations.