Fixing access to document object.

onDomReady has some weird way to access document.