Fix loadTemplate to handle null return from widgetNode.