Effects of spurious modes in resonant cavities