Fix caching to avoid widget inception

Also cleared up a few more notices by adding some `isset` checks and minor whitespace changes