Fix typing issue that lead to int overflows on 32 bit platforms.