improved error treatment on file type detection error, more work needed