better protection for unexpected errors, so that we don't crash anyone's browser