Fixed several notices in core and bundled plugins.

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