Fixed the logic to identify no templates condition