added script in error handling function