As for innocent people dying, this is just collateral damage, nothing is ever perfect, nor can it ever be perfect, you have to choose the best option.
The best option would be to remove the persons liberty indefinitely, that way the chances of collateral damage are negated and if they are truly guilty they're also punished.
Logically if you look at the options available to a court and the consequences of each of those options, capital punishment is actually the least logical as it equates to revenge rather than justice, it doesn't allow for human error or for remorse or apology. Capital punishment doesn't offer anything that indefinite incarceration does not, even the costs are comparable.
So why would you logically take another life in revenge of another at the risk of it being the loss of two innocent lives instead of one? Where is the logic in that?