Attempt to fix integer overflow