Integer overflow bug fixed