Fixing bug that caused arithm overflow exception.