Improved mode test