added mime type checking