refactoring. Fixed bug where MIME type would not be guessed for files with uppercase filename