Fix miscalculation introduced by early exit.