Fixes to format auto-detection