Gauge unfixing formalism of the O(N) nonlinear sigma model