Also set oldimage.onerror to null, perhaps?