Wellposedness by perturbation in optimization problems