Improving script error handler and summary stats