trimbd bug fix

replace kind=1 integer sum