Singularities of periodic orbits near invariant curves