Issue #21628: More fixes to calculations
Issue #21628: Fixed compile error