added validity check for mimetypes