On the stability of a class of modified gravitational models