Base theme undefined and empty variable checks in clean install

If you do a clean install and enable the debug options you'll run into several undefined or empty variable errors. This should fix all of them (or at least the ones I could find / were reported).