fixed error with DOM loading