Fix integer overflow