The linear coupling between ordinary and extraordinary electron cyclotron waves in the vicinity of the cut-off plasma density is discussed, taking into account variation of a magnetic field on flux surfaces in tokamaks and stellarators. Previously developed theory of two-dimensional mode conversion is applied to study the effects of the poloidal magnetic field and its shear, in particular, on the efficiency of penetration of quasi-optical beams through the evanescent layer due to transformation into a cross mode.