Fix mode detection