Correcting the effects of spontaneous emission on cold-trapped ions