improved script stop