fixed integer overflow

this is a cheap fix, any ideas for a better fix?