fix integer overflow issue