put function bugfix with detection of mime type