Fixed several notices in core and bundled plugins.

There is still a lot left. I didn't dig into notices and wasn't sure how to fix problems with collections handling using undefined arrays.