changed overflow check