Instanceof null fix

This is a fix for the following test:

try {
    1 instanceof null;
} catch (e) {
    console.log(e);
}

There is a minor change in the way instanceof works (to check for null).  I also changed the way that exceptions are handled so that errors that are explicitly thrown can be accurately logged (which was needed to get the test to pass).