Fixed bug in Template.php