Fixed parsing of enclosed template tags