Fixed several overflowing int32 problems (note that this was purely cosmetic problem; it didn't affect the correctness of results.)