Getting rid of various PHP notice warnings

* Assigned empty defaults on templates
* Added some variable checking