fixed the overflow bug