Fix bug related to error thrown from global scripts. Closes #7