Added app.locals.checkDef function to check if objects are defined. Updated all Jade template variable insertions to call this function.