Fixed <template> handling; Fixed tests