fix overflow bug