Various bugfixes

Mostly eliminating E_NOTICE level errors, but also some more serious bugs involving saving custom fields, stying navbars and category landings, and so forth (see commit log).