Manually merged rounding bug fix from master