Fix bug when DOM node is not found