modify error occurrence when exit == true