making detection of mode sane