use a more-correct integer type, and silence 64-bit warnings as a bonus