Fixing DOMContentLoaded listener that was also broken on IE8