Fixed integer overflow bug