fix issue with file extension not being detected properly (fixes issue #2183)