trap err on executed scripts