Remove a node in a template - fixed the exception