Lagrangian systems in presence of singularities