fixed a bug where onload may not be present, so we can't always try to call it on a retry