fixed error in script destructor