fixed ErrorHandling and script killing