Fixed potential integer overflow problem.