added check to prevent access to non-initialized DOM Object