Maintenance mode in strict environment VS undefined collection object

Hello there!
On my server I have set error reporting threshold to throw PHP Notices too.
I didn't manage to have "Maintenance Mode" working until applying below fixes to check every time if a Collection object is defined.