Terminate when handlnig errors