Change to use mime_type instead of type to avoid possible conflict with built-in type