Fixed integer overflow issues.