error check when destroy