In this paper we propose a new formulation of the Fourier Modal Method based on an alternative treatment of interface conditions allowing us to overcome the effect of the Gibbs phenomenon. Explicit consideration of the interface conditions for the discontinuous part of the field leads to new equations for the eigenvalue problem and the transfer matrix. The results of the method are in good agreement with the results for the classical approach based on the Li factorization rules. Moreover, the developed method allows calculating the near field much more accurately, and may find its applications in sensing and nonlinear optics.