check if model is valid before applying destructor