IE8 fix and better error reporting