bug fix related to document now being top of dom tree