A new and improved version of second order analytical proper elements has been obtained by taking into account the secular perturbations of the asteroids, by the four major planets, and also part of the effect of the inner planets. The stability of the proper elements with time has been tested by generating accurate solutions using numerical integration and by measuring directly the deviations from constancy; this test has been performed on 22 asteroids and for a time span of 400,000 years. The results show significantly improved accuracy both for proper eccentricities and for proper inclinations. For proper semimajor axes and inclinations, further improvement seems to be neither easy nor useful, because the accuracy is already as good as it needs to be; for the eccentricity, some improvements are possible; exceptional cases, for which the accuracy of the proper elements is spoiled by resonances, are understood and their negative effects can be controlled by the use of resonance warnings and quality codes automatically provided by the algorithm. Nonlinear secular resonances do not occur in the classical linear theory of secular perturbations and have been studied very little so far. We present here a detailed study of the effects of the g + s − g 6 − 2 6 resonance, of the g + s − g 5 − s 7 resonance, and of their interaction, performed by combining the proper elements algorithm in an adapted version with a numerical integration of seven asteroids for 5,400,000 years. These resonances cut the Eos family, but have a minor effect on our capability to identify the family members. Nevertheless, the long term dynamics of many Eos family asteroids is strongly influenced by these resonances: e.g., 221 Eos and 339 Dorothea are librators in the g + s − g 6 resonance, 1075 Helina and 320 Katharina are probably locked into the g + s − g 5 − 2 7 resonance. In contrast, the small Lydia family is strongly perturbed by these secular resonances: the list of family members, and even the statistical reliability of the cluster in the phase space, are sgnificantly changed if the resonant effects are taken into account.