Don't crash when root element is not displayed (fix #113)