Stability in Generalized Modified Gravity