Stability of solitons in nonlinear composite media