We have extended a previous calculation of the energy of a weakly heterogeneous waveguide to fourth order in the density perturbation, deriving its general expression. For particular configurations where the second and third orders both vanish, we discover that the fourth order contribution lowers in general the energy of the state, below the threshold of the continuum. In these cases the waveguide possesses a localized state. We have applied our general formula to a solvable model with vanishing second and third orders reproducing the exact expression for the fourth order.