Fix debug function broken in IE8