Added failsafe to prevent DOM exception 22
Merge branch 'fix-dom-exception-22' into gh-pages