Fixed a bug in record replay due to uncaught exception in a top-level script