fix code for overflow