Merge "Adjust types in hbd error computation to avoid overflow" into nextgenv2