work around for failure on catching document.onload event