Improve auto-detection of tab-mode