check for every variable,so it will not give error in future

Apply checks in template.php file