handling error events in CLI mode fixed