Fix for errors wrt exceptions in the global scope. Fixes issue 1070
R=blickly