fixed an overflow in an intermediate result on 32-bit platform. Checked that the new test catch this bug in 32-bit mode.