int overflow bug fixed