Changes to add IE 9 compatibility

(In IE 9 apply() is implemented on everything, except console etc, sigh)