Use correct exception for Template stack