Fix onload handling in older browsers