Fixing issue #2923 - Getting mode from file extension won't always work