added overflow check in serial utility