Fix IE8 problems in `$log` and general startup

Fixes #5400. Fixes #5147.